diff options
author | Emile <git@emile.space> | 2025-02-22 22:44:31 +0100 |
---|---|---|
committer | Emile <git@emile.space> | 2025-02-22 22:44:31 +0100 |
commit | 4100097801550fe86399453b7922875015f34ff9 (patch) | |
tree | 5c5103bf72b5b422278900a90c138e73a0bcfb65 /flake.nix | |
parent | e220cd7ed1ff8b9a84e4660519ca0f74720f9e6e (diff) |
goapp frontend now works on corrino
added an overlay (which took quite some time, as I forgot to include the self parameter in the argument list...) that allows using the goapp on corrino. So now you can... ... use the template ... see the package status after it has been built using hydra ... build the package from the packages exposed by the flake ... use the package on machines including it using an overlay I'm actually quite satisfied with this and hope people find this helpful
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 107 |
1 files changed, 72 insertions, 35 deletions
diff --git a/flake.nix b/flake.nix index 51e0093..030fbe2 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,7 @@ { inputs = { nixpkgs.url = "git+ssh://git@github.com/nixos/nixpkgs.git?shallow=1&ref=nixos-24.11"; + nixpkgs2.url = "git+ssh://git@github.com/nixos/nixpkgs.git?shallow=1&ref=nixos-24.11"; nixpkgs-unstable.url = "git+https://github.com/nixos/nixpkgs?ref=nixpkgs-unstable"; # nix darwin version must match nixpkgs version: @@ -35,20 +36,56 @@ outputs = { self, - nixpkgs, # packages + nixpkgs, # packages + nixpkgs2, # packages2 nixpkgs-unstable, # unstable branch - darwin, # darwin related stuff - deploy-rs, # deploy the hosts - agenix, # store secrets crypted using age - home-manager, # manage my home envs - naersk, # build rust stuff - flake-utils, # common flake utils + darwin, # darwin related stuff + deploy-rs, # deploy the hosts + agenix, # store secrets crypted using age + home-manager, # manage my home envs + naersk, # build rust stuff + flake-utils, # common flake utils # hefe-internal, # internal tooling ... }@inputs: let lib = import ./nix/lib inputs; helper = lib.flake-helper; + + # TODO(emile): move all these functions into the helper, keeping the flake.nix clean + + # A function taking an attribute set of flake templates, importing their + # flake.nix/output/packages (if there are any) and returning an attribute set + # of their packages (if the template has one or more) + template-packages = + templ: + (builtins.mapAttrs ( + name: value: + (((import ./nix/templates/${name}/flake.nix).outputs) { + inherit flake-utils; + + # need to provide nixpkgs WITHOUT the overlay for the packages defined in the template applied + nixpkgs = nixpkgs; + }).packages or { } + ) templ); + + # apply the above function to the templates + templates = template-packages self.templates; + + # Merge template packages into root packages with template prefix + mergedTemplatePackages = + system: + let + lib = nixpkgs.lib; + in + lib.foldl ( + acc: tplName: + let + tplPkgs = templates.${tplName}.${system} or { }; + prefixed = lib.mapAttrs' (pkgName: pkg: lib.nameValuePair "${tplName}-${pkgName}" pkg) tplPkgs; + in + acc // prefixed + ) { } (builtins.attrNames templates); in { hosts = { @@ -63,15 +100,15 @@ }; # main vm host - # + # # in case of broken config, reboot into recovery, then: - # + # # cryptsetup luksOpen /dev/md1 luks0 # mount /dev/disk/by-label/root /mnt # mkdir /mnt/boot # mount /dev/disk/by-label/root /mnt # grub-reboot --boot-directory /mnt/boot "Ni" <- press tab and choose wisely - # + # # also see # //nix/hosts/corrino/hetzner-dedicated-wipe-and-install-nixos-luks-raid-lvm.sh corrino = { @@ -80,6 +117,18 @@ description = "Hetzner AX41 dual 512GB NVME"; modules = [ # hefe-internal.nixosModules.corrino + ( + { self, ... }: + { + nixpkgs.overlays = [ + (final: prev: { + inherit (self.packages.x86_64-linux) + goapp-frontend + ; + }) + ]; + } + ) ]; }; chusuk = { @@ -120,7 +169,7 @@ # lankiveil = { # system = "x86_64-linux"; # ???, ???, RTX A2000 - # description = ""; + # description = "Router"; # }; # poritrin = { # description = "lankiveil bmc"; @@ -155,13 +204,11 @@ }; overlays = { - emile = import ./nix/pkgs/overlay.nix; + default = self.overlays.x86_64-linux; x86_64-linux = import ./nix/pkgs/x86_64-linux.nix; aarch64-darwin = import ./nix/pkgs/aarch64-darwin.nix; - default = self.overlays.x86_64-linux; - unstable = final: prev: { unstable = import nixpkgs-unstable { system = "x86_64-linux"; @@ -169,9 +216,9 @@ }; }; - # no clue why, but when rebuilding corrino and this not being commented, something in the - # hardware.bluetooth module breaks - # + # no clue why, but when rebuilding corrino and this not being commented, + # something in the hardware.bluetooth module breaks + # # unstable-darwin = final: prev: { # unstable-darwin = import nixpkgs-unstable { # system = "aarch64-darwin"; @@ -195,7 +242,6 @@ pkgs = import nixpkgs { inherit system; overlays = [ - ( if system == "x86_64-linux" then self.overlays.x86_64-linux @@ -204,30 +250,20 @@ else null ) - # self.overlays.emile - # some arguments for packages (_: _: { inherit naersk; }) ]; }; in - { + # take all the packages exposed from templates and add them to + # the packages exposed by this flake + mergedTemplatePackages system + // { inherit (pkgs) vokobe r2wars-web remarvin; } ); - hydraJobs = let - # A function taking an attribute set of flake templates, importing their flake.nix and returning an attribute ste of their packages (if the template has one or more) - template-packages = templ: - (builtins.mapAttrs - (name: value: - ( - ( - (import ./nix/templates/${name}/flake.nix).outputs) { - inherit nixpkgs flake-utils; - }).packages or {}) - templ); - in { + hydraJobs = { inherit (self) packages; nixosConfigurations = helper.buildHosts self.nixosConfigurations; templates = template-packages self.templates; @@ -260,7 +296,8 @@ ''; }; - # checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; + # checks = builtins.mapAttrs (system: deployLib: + # deployLib.deployChecks self.deploy) deploy-rs.lib; + }; }; - }; } |