diff --git a/flake.lock b/flake.lock index dde38ff3..2eab6a73 100644 --- a/flake.lock +++ b/flake.lock @@ -378,11 +378,32 @@ "plasma-manager": "plasma-manager", "pre-commit-hooks": "pre-commit-hooks", "riscv-overlay": "riscv-overlay", + "rust-overlay": "rust-overlay", "sops-nix": "sops-nix", "systems": "systems", "vscode-server": "vscode-server" } }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731464916, + "narHash": "sha256-WZ5rpjr/wCt7yBOUsvDE2i22hYz9g8W921jlwVktRQ4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "2c19bad6e881b5a154cafb7f9106879b5b356d1f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 0596362f..80b444b7 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,10 @@ url = "github:DarkKirb/riscv-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/default.nix b/modules/default.nix index 46bc259a..ba484777 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -4,6 +4,7 @@ lib, inTester, self, + rust-overlay, ... }: with lib; @@ -27,6 +28,7 @@ with lib; { nixpkgs.overlays = [ self.overlays.default + (import rust-overlay) ]; } else diff --git a/programs/desktop/development/rust/default.nix b/programs/desktop/development/rust/default.nix new file mode 100644 index 00000000..b22cb540 --- /dev/null +++ b/programs/desktop/development/rust/default.nix @@ -0,0 +1,47 @@ +{ + pkgs, + config, + systemConfig, + ... +}: +{ + home.packages = with pkgs; [ + (rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)) + cargo-mommy + ]; + home.shellAliases = { + cargo = "${pkgs.cargo-mommy}/bin/cargo-mommy"; + }; + home.sessionVariables = + ( + if systemConfig.isNSFW then + { + CARGO_MOMMYS_MOODS = "chill/thirsty/yikes"; + CARGO_MOMMYS_LITTLE = "racc/plush"; + CARGO_MOMMYS_PARTS = "shit/pee"; + CARGO_MOMMYS_FUCKING = "pet/toy/toilet/shitslut/septic tank"; + } + else + { + CARGO_MOMMYS_MOODS = "chill"; + CARGO_MOMMYS_LITTLE = "racc/plush"; + } + ) + // { + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + }; + systemd.user.tmpfiles.rules = [ + "d ${config.xdg.cacheHome}/cargo - - - - -" + "d ${config.xdg.cacheHome}/cargo/git - - - - -" + "d ${config.xdg.cacheHome}/cargo/registry - - - - -" + "L ${config.xdg.dataHome}/cargo/git - - - - ${config.xdg.cacheHome}/cargo/git" + "L ${config.xdg.dataHome}/cargo/registry - - - - ${config.xdg.cacheHome}/cargo/registry" + ]; + xdg.dataFile."cargo/config.toml".source = (pkgs.formats.toml { }).generate "config.toml" { + build.target-dir = "${config.xdg.cacheHome}/cargo/target"; + profile.release = { + lto = true; + codegen-units = 1; + }; + }; +} diff --git a/programs/desktop/home-manager.nix b/programs/desktop/home-manager.nix index a4783d78..124cd34a 100644 --- a/programs/desktop/home-manager.nix +++ b/programs/desktop/home-manager.nix @@ -10,6 +10,7 @@ "${nixos-config}/services/desktop" ./kodi ./pim + ./development/rust ]; home.packages = with pkgs; [ kdePackages.kalk