Extended registry and ISO+DO generator

This commit is contained in:
Filippo Berto 2022-12-18 12:11:55 +01:00
parent cc1abacb29
commit ad69610e89
Signed by: bertof
GPG key ID: 9DBF7E6A1D2CE9ED
3 changed files with 108 additions and 66 deletions

79
flake.lock generated
View file

@ -133,6 +133,40 @@
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1636849918,
"narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1671355134,
"narHash": "sha256-ZtnUWTDDyFog+NQBjZpnhgPdj3gHp5ImxFVWy+ObNno=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "64a96ca8621d03cb3889daf0d3ff58d8209e3e0c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1670174919,
@ -197,6 +231,22 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1637186689,
"narHash": "sha256-NU7BhgnwA/3ibmCeSzFK6xGi+Bari9mPfn+4cBmyEjw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7fad01d9d5a3f82081c00fb57918d64145dc904c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1670939335,
"narHash": "sha256-AJmruD+RI6smxiVnfpmNT7275mZsUdCS5zczeQCyy3o=",
@ -269,34 +319,11 @@
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nix-rice": "nix-rice",
"nixos-generators": "nixos-generators",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"nixpkgs-u": "nixpkgs-u",
"pre-commit-hooks": "pre-commit-hooks_2",
"tex2nix": "tex2nix"
}
},
"tex2nix": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1665144382,
"narHash": "sha256-CCnC3YsQCGoKIGdMND+pr5Rl7nufT1Krv1TZPBIEm8o=",
"owner": "Mic92",
"repo": "tex2nix",
"rev": "068e8655c754783d86f442f887f2e92305d9bd4a",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "tex2nix",
"type": "github"
"pre-commit-hooks": "pre-commit-hooks_2"
}
},
"utils": {

View file

@ -14,7 +14,7 @@
# };
deploy-rs.url = "github:serokell/deploy-rs";
flake-utils.url = "github:numtide/flake-utils";
# nixos-generators.url = "github:nix-community/nixos-generators";
nixos-generators.url = "github:nix-community/nixos-generators";
nixos-hardware.url = "github:NixOS/nixos-hardware";
nix-rice = {
url = "github:bertof/nix-rice";
@ -28,11 +28,6 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
tex2nix = {
url = "github:Mic92/tex2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs =
@ -46,8 +41,8 @@
nixos-hardware
, nix-rice
, pre-commit-hooks
, tex2nix
,
, nixos-generators
, ...
}:
let
config = {
@ -117,47 +112,23 @@
commonModules = [
# Nix configuration
({ pkgs, ... }: {
{
nixpkgs = { inherit overlays config; };
nix = {
package = pkgs.nixVersions.stable;
extraOptions = "experimental-features = nix-command flakes";
registry = {
stable = {
from = {
id = "stable";
type = "indirect";
};
flake = nixpkgs;
};
unstable = {
from = {
id = "unstable";
type = "indirect";
};
flake = nixpkgs-u;
};
tex2nix = {
from = {
id = "tex2nix";
type = "indirect";
};
flake = tex2nix;
};
stable = { from = { id = "stable"; type = "indirect"; }; flake = nixpkgs; };
unstable = { from = { id = "unstable"; type = "indirect"; }; flake = nixpkgs-u; };
};
};
})
# Home manager configuration
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
};
}
# Home manager configuration
home-manager.nixosModules.home-manager
{ home-manager = { useGlobalPkgs = true; useUserPackages = true; }; }
./nixos_modules/bertof_user.nix
./nixos_modules/extended_registry.nix
./nixos_modules/automatic-garbage-collection.nix
./nixos_modules/automatic-upgrade.nix
./nixos_modules/zerotier.nix
@ -295,6 +266,23 @@
};
};
images = with flake-utils.lib; eachSystem [ system.x86_64-linux system.aarch64-linux ] (system: {
packages = {
# Installer ISO
install-iso = nixos-generators.nixosGenerate {
inherit system;
modules = commonModules ++ [{ services.openssh = { enable = true; openFirewall = true; }; }];
format = "install-iso";
};
# Installer DigitalOcean
do = nixos-generators.nixosGenerate {
inherit system;
modules = commonModules ++ [{ services.openssh = { enable = true; openFirewall = true; }; }];
format = "do";
};
};
});
in
builtins.foldl' nixpkgs.lib.recursiveUpdate { } [
basic
@ -304,5 +292,6 @@
# baldurConfig
lokiConfig
deployments
images
];
}

View file

@ -0,0 +1,26 @@
{
nix.registry = {
my-templates = {
from = {
id = "my-templates";
type = "indirect";
};
to = {
type = "github";
owner = "bertof";
repository = "flake-templates";
};
};
tex2nix = {
from = {
id = "tex2nix";
type = "indirect";
};
to = {
type = "github";
owner = "Mic92";
repository = "tex2nix";
};
};
};
}