diff options
author | Franck Cuny <franck@fcuny.net> | 2022-09-26 17:50:41 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-09-26 17:50:41 -0700 |
commit | 2a7b36213c1b8bc9e03466bd7b99fa96abfecd8f (patch) | |
tree | 6dd3fd5db0519e5fdb5e04fd329de16e49dfdd30 /nix | |
parent | fix(flake): call some programs with `nix run .#tools.<name>` (diff) | |
download | world-2a7b36213c1b8bc9e03466bd7b99fa96abfecd8f.tar.gz |
feat(naersk): use naersk to build packages with rust
naersk makes it simple to build rust project in nix. For this to work, `mkSystem` and `mkHomeManagerConfiguration` needs to pass naersk to my overlays. I dropped the support to run the tools with `nix run .#tools...`: I don't use this in practice and it's not making things simpler. I dropped `nix-linter` from the check, it's reporting many errors without helping me to fix them.
Diffstat (limited to '')
-rw-r--r-- | nix/mkHomeManagerConfiguration.nix | 10 | ||||
-rw-r--r-- | nix/mkSystem.nix | 12 |
2 files changed, 15 insertions, 7 deletions
diff --git a/nix/mkHomeManagerConfiguration.nix b/nix/mkHomeManagerConfiguration.nix index bcf374a..70e875d 100644 --- a/nix/mkHomeManagerConfiguration.nix +++ b/nix/mkHomeManagerConfiguration.nix @@ -3,9 +3,11 @@ inputs@{ self, ... }: , username ? "fcuny" , hostname , stateVersion ? "22.05" -, extraModules ? [ ] , }: +let + naersk = inputs.naersk.lib."${system}"; +in inputs.home-manager.lib.homeManagerConfiguration { inherit system; inherit username; @@ -19,8 +21,12 @@ inputs.home-manager.lib.homeManagerConfiguration { overlays = [ inputs.emacs-overlay.overlay inputs.nur.overlay + inputs.naersk.overlay inputs.rust.overlays.default - (final: prev: { tools = import "${self}/tools" { pkgs = prev; }; }) + (final: prev: + { + tools = import "${self}/tools" { pkgs = prev; inherit naersk; }; + }) ]; }; configuration.imports = diff --git a/nix/mkSystem.nix b/nix/mkSystem.nix index 00b5664..4debbab 100644 --- a/nix/mkSystem.nix +++ b/nix/mkSystem.nix @@ -1,5 +1,8 @@ inputs@{ self, ... }: { system ? "x86_64-linux", hostname, }: +let + naersk = inputs.naersk.lib."${system}"; +in inputs.nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs system hostname; }; @@ -14,13 +17,12 @@ inputs.nixpkgs.lib.nixosSystem { overlays = [ inputs.nur.overlay inputs.rust.overlays.default - (final: prev: { tools = import "${self}/tools" { pkgs = prev; }; }) + (final: prev: + { + tools = import "${self}/tools" { pkgs = prev; inherit naersk; }; + }) ]; }; - # Add each input as a registry - nix.registry = inputs.nixpkgs.lib.mapAttrs' - (n: v: inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; })) - inputs; } ]; } |