Added container generator config

This commit is contained in:
Erwin Boskma 2022-01-24 11:17:44 +01:00
parent 6b5f845d53
commit a1d4a866a2
Signed by: erwin
GPG key ID: 270B20D17394F7E5
3 changed files with 125 additions and 96 deletions

View file

@ -15,28 +15,17 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"ha-now-playing": { "ha-now-playing": {
"inputs": { "inputs": {
"naersk": "naersk", "naersk": [
"naersk"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"rust-overlay": "rust-overlay", "rust-overlay": [
"rust-overlay"
],
"utils": [ "utils": [
"flake-utils" "flake-utils"
] ]
@ -63,11 +52,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1642117744, "lastModified": 1642463065,
"narHash": "sha256-/SvxBe/m6JiRSlKIrgD6LQxee9GGewFyq+lsPxoViMY=", "narHash": "sha256-Db53xzDOouhsDAQ/QCvLeM0r7p+my5Zb5jgWGpCrOVo=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "a5dd5d5f197724f3065fd39c59c7ccea3c8dcb8f", "rev": "c491331718bd41722a2982a5532eb0ff51c3ca28",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -78,78 +67,67 @@
}, },
"naersk": { "naersk": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1637576998, "lastModified": 1639947939,
"narHash": "sha256-bGQ66hh4Dl78T9bd1pqdp6fprHMCkrkeKqED6sDUYqo=", "narHash": "sha256-pGsM8haJadVP80GFq4xhnSpNitYNQpaXk4cnA796Cso=",
"owner": "nmattia", "owner": "nix-community",
"repo": "naersk", "repo": "naersk",
"rev": "b043f2447a4a761529254f4983cacd94b034a122", "rev": "2fc8ce9d3c025d59fee349c1f80be9785049d653",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nmattia", "owner": "nix-community",
"ref": "master",
"repo": "naersk", "repo": "naersk",
"type": "github" "type": "github"
} }
}, },
"naersk_2": { "nixlib": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": { "locked": {
"lastModified": 1637576998, "lastModified": 1636849918,
"narHash": "sha256-bGQ66hh4Dl78T9bd1pqdp6fprHMCkrkeKqED6sDUYqo=", "narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=",
"owner": "nmattia", "owner": "nix-community",
"repo": "naersk", "repo": "nixpkgs.lib",
"rev": "b043f2447a4a761529254f4983cacd94b034a122", "rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nmattia", "owner": "nix-community",
"ref": "master", "repo": "nixpkgs.lib",
"repo": "naersk", "type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1640542138,
"narHash": "sha256-2f+Dslfzkuj0pgBl+70lkiTCg+U2Q0TcOikwxpsU+Fk=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "296067b9c7a172d294831dec89d86847f30a7cfc",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1641887635, "lastModified": 1642281915,
"narHash": "sha256-kDGpufwzVaiGe5e1sBUBPo9f1YN+nYHJlYqCaVpZTQQ=", "narHash": "sha256-jcMsXmmO1knyf99o242A+2cy1A0eKa9afly0cwBknPA=",
"path": "/nix/store/1hdyp90ilq8gksc56dryg991kq3pc9bb-source",
"rev": "b2737d4980a17cc2b7d600d7d0b32fd7333aca88",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1642069818,
"narHash": "sha256-666w6j8wl/bojfgpp0k58/UJ5rbrdYFbI2RFT2BXbSQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "46821ea01c8f54d2a20f5a503809abfc605269d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1642104392,
"narHash": "sha256-m71b7MgMh9FDv4MnI5sg9MiBVW6DhE1zq+d/KlLWSC8=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5aaed40d22f0d9376330b6fa413223435ad6fee5", "rev": "d5dae6569ea9952f1ae4e727946d93a71c507821",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -159,22 +137,11 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": {
"locked": {
"lastModified": 1641887635,
"narHash": "sha256-kDGpufwzVaiGe5e1sBUBPo9f1YN+nYHJlYqCaVpZTQQ=",
"path": "/nix/store/1hdyp90ilq8gksc56dryg991kq3pc9bb-source",
"rev": "b2737d4980a17cc2b7d600d7d0b32fd7333aca88",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"pamedia": { "pamedia": {
"inputs": { "inputs": {
"naersk": "naersk_2", "naersk": [
"naersk"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
@ -202,22 +169,29 @@
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"ha-now-playing": "ha-now-playing", "ha-now-playing": "ha-now-playing",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs_3", "naersk": "naersk",
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs",
"pamedia": "pamedia", "pamedia": "pamedia",
"rust-overlay": "rust-overlay",
"sops": "sops" "sops": "sops"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": [
"nixpkgs": "nixpkgs_2" "flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1642128126, "lastModified": 1642559502,
"narHash": "sha256-av8JUACdrTfQYl/ftZJvKpZEmZfa0avCq7tt5Usdoq0=", "narHash": "sha256-Dy3ziFejnG1jSsMem19nxDySzGCWbWujUDRQFIDT7BE=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "ce4ef6f2d74f2b68f7547df1de22d1b0037ce4ad", "rev": "308ac16f932e52394ca3d35dbd6cda1940aaa0f5",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -11,6 +11,22 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
sops = { sops = {
url = "github:Mic92/sops-nix"; url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -20,12 +36,15 @@
url = "git+https://@git.datarift.nl/erwin/ha-now-playing.git?ref=main"; url = "git+https://@git.datarift.nl/erwin/ha-now-playing.git?ref=main";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils"; inputs.utils.follows = "flake-utils";
inputs.naersk.follows = "naersk";
inputs.rust-overlay.follows = "rust-overlay";
}; };
pamedia = { pamedia = {
url = "git+https://git.datarift.nl/erwin/pamedia-rs.git?ref=main"; url = "git+https://git.datarift.nl/erwin/pamedia-rs.git?ref=main";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils"; inputs.utils.follows = "flake-utils";
inputs.naersk.follows = "naersk";
}; };
}; };
@ -39,8 +58,36 @@
modules = [ modules = [
{ _module.args.inputs = inputs; } { _module.args.inputs = inputs; }
{ _module.args.self-overlay = self.overlay; } { _module.args.self-overlay = self.overlay; }
{ _module.args.pamedia-overlay = pamedia.overlays.${system}; } ({ ... }: {
{ _module.args.ha-now-playing-overlay = ha-now-playing.overlays.${system}; } imports = builtins.attrValues self.nixosModules ++ [
{
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
nixpkgs.overlays = [
self.overlay
ha-now-playing.overlays.${system}
pamedia.overlays.${system}
];
}
baseConfig
home-manager.nixosModules.home-manager
{ home-manager.useUserPackages = true; }
];
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
nix.registry.nixpkgs.flake = nixpkgs;
})
sops.nixosModules.sops
];
};
defContainer = system: baseConfig:
nixos-generators.nixosGenerate {
pkgs = nixpkgs.legacyPackages.${system};
format = "lxc";
modules = [
{ _module.args.inputs = inputs; }
{ _module.args.self-overlay = self.overlay; }
({ ... }: { ({ ... }: {
imports = builtins.attrValues self.nixosModules ++ [ imports = builtins.attrValues self.nixosModules ++ [
{ {
@ -105,6 +152,14 @@
]; ];
}; };
}; };
nixosContainers = {
proxy = defContainer "x86_64-linux" {
imports = [
(import (./machines/proxy/configuration.nix) { inherit self; })
];
};
};
} // } //
(flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ]) (flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ])
(system: (system:

View file

@ -1,4 +1,4 @@
{ lib, pkgs, config, inputs, self-overlay, ha-now-playing-overlay, pamedia-overlay, ... }: { lib, pkgs, config, inputs, self-overlay, ... }:
with lib; with lib;
let let
cfg = config.eboskma.desktop; cfg = config.eboskma.desktop;
@ -161,8 +161,8 @@ in
{ {
nixpkgs.overlays = [ nixpkgs.overlays = [
self-overlay self-overlay
ha-now-playing-overlay inputs.ha-now-playing.overlays.${pkgs.system}
pamedia-overlay inputs.pamedia.overlays.${pkgs.system}
]; ];
} }
../../home-manager/modules/alacritty ../../home-manager/modules/alacritty