add rust support to config

This commit is contained in:
Schrottkatze 2024-04-16 21:37:01 +02:00
parent 5c2deec279
commit 52a6173f0b
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
7 changed files with 126 additions and 30 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
result result
.direnv/ .direnv/
programs/*/target

View file

@ -5,6 +5,7 @@
config, config,
pkgs, pkgs,
lib, lib,
rs-programs,
... ...
}: }:
with lib; with lib;
@ -25,6 +26,7 @@ with builtins; {
"nodejs-16.20.0" "nodejs-16.20.0"
]; ];
}; };
overlays = [rs-programs];
}; };
environment = { environment = {
@ -73,6 +75,8 @@ with builtins; {
devd devd
libjxl libjxl
s10e-jrnl
]; ];
}; };

View file

@ -41,6 +41,25 @@
"url": "https://gitlab.com/obsidianical/easymacros.git" "url": "https://gitlab.com/obsidianical/easymacros.git"
} }
}, },
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs_4",
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1713248681,
"narHash": "sha256-wB/Hz8tP8xzNnfJotyeAWhxxe6R2BOI0DWOtDBFgEgc=",
"owner": "nix-community",
"repo": "fenix",
"rev": "402051dcf16bcaa14dcbd96d2d5b4a97664eb35c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@ -129,7 +148,7 @@
"gumseite": { "gumseite": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_5"
}, },
"locked": { "locked": {
"lastModified": 1680175611, "lastModified": 1680175611,
@ -206,7 +225,7 @@
"karton": { "karton": {
"inputs": { "inputs": {
"naersk": "naersk_2", "naersk": "naersk_2",
"nixpkgs": "nixpkgs_6", "nixpkgs": "nixpkgs_7",
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
@ -239,7 +258,7 @@
"meowsite": { "meowsite": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_7" "nixpkgs": "nixpkgs_8"
}, },
"locked": { "locked": {
"lastModified": 1678920998, "lastModified": 1678920998,
@ -275,7 +294,7 @@
}, },
"naersk_2": { "naersk_2": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1671096816, "lastModified": 1671096816,
@ -294,7 +313,7 @@
}, },
"naersk_3": { "naersk_3": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_9" "nixpkgs": "nixpkgs_10"
}, },
"locked": { "locked": {
"lastModified": 1671096816, "lastModified": 1671096816,
@ -374,6 +393,20 @@
} }
}, },
"nixpkgs_10": { "nixpkgs_10": {
"locked": {
"lastModified": 1675614288,
"narHash": "sha256-i3Rc/ENnz62BcrSloeVmAyPicEh4WsrEEYR+INs9TYw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d25de6654a34d99dceb02e71e6db516b3b545be6",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_11": {
"locked": { "locked": {
"lastModified": 1675614288, "lastModified": 1675614288,
"narHash": "sha256-i3Rc/ENnz62BcrSloeVmAyPicEh4WsrEEYR+INs9TYw=", "narHash": "sha256-i3Rc/ENnz62BcrSloeVmAyPicEh4WsrEEYR+INs9TYw=",
@ -418,6 +451,22 @@
} }
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": {
"lastModified": 1712963716,
"narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cfd6b5fc90b15709b780a5a1619695a88505a176",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1679966490, "lastModified": 1679966490,
"narHash": "sha256-k0jV+y1jawE6w4ZvKgXDNg4+O9NNtcaWwzw8gufv0b4=", "narHash": "sha256-k0jV+y1jawE6w4ZvKgXDNg4+O9NNtcaWwzw8gufv0b4=",
@ -433,7 +482,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_6": {
"locked": { "locked": {
"lastModified": 1677852945, "lastModified": 1677852945,
"narHash": "sha256-liiVJjkBTuBTAkRW3hrI8MbPD2ImYzwUpa7kvteiKhM=", "narHash": "sha256-liiVJjkBTuBTAkRW3hrI8MbPD2ImYzwUpa7kvteiKhM=",
@ -447,7 +496,7 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_6": { "nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1677852945, "lastModified": 1677852945,
"narHash": "sha256-liiVJjkBTuBTAkRW3hrI8MbPD2ImYzwUpa7kvteiKhM=", "narHash": "sha256-liiVJjkBTuBTAkRW3hrI8MbPD2ImYzwUpa7kvteiKhM=",
@ -463,7 +512,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_7": { "nixpkgs_8": {
"locked": { "locked": {
"lastModified": 1674407282, "lastModified": 1674407282,
"narHash": "sha256-2qwc8mrPINSFdWffPK+ji6nQ9aGnnZyHSItVcYDZDlk=", "narHash": "sha256-2qwc8mrPINSFdWffPK+ji6nQ9aGnnZyHSItVcYDZDlk=",
@ -479,7 +528,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_8": { "nixpkgs_9": {
"locked": { "locked": {
"lastModified": 1712608508, "lastModified": 1712608508,
"narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=", "narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=",
@ -494,36 +543,40 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_9": {
"locked": {
"lastModified": 1675614288,
"narHash": "sha256-i3Rc/ENnz62BcrSloeVmAyPicEh4WsrEEYR+INs9TYw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d25de6654a34d99dceb02e71e6db516b3b545be6",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": { "root": {
"inputs": { "inputs": {
"arion": "arion", "arion": "arion",
"easymacros": "easymacros", "easymacros": "easymacros",
"fenix": "fenix",
"gumseite": "gumseite", "gumseite": "gumseite",
"home-manager": "home-manager", "home-manager": "home-manager",
"karton": "karton", "karton": "karton",
"mac-brcm-fw": "mac-brcm-fw", "mac-brcm-fw": "mac-brcm-fw",
"meowsite": "meowsite", "meowsite": "meowsite",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_8", "nixpkgs": "nixpkgs_9",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable-small": "nixpkgs-unstable-small", "nixpkgs-unstable-small": "nixpkgs-unstable-small",
"wordsofgod": "wordsofgod" "wordsofgod": "wordsofgod"
} }
}, },
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1713212246,
"narHash": "sha256-lkNQ/oqb1vyvAVcZ6s8Bf6X00SqbEhdU+kPLX+C+PW8=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "90cfa8035f98d3ab0f7f4f1e77f4f5e3b0a7370b",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1676283394, "lastModified": 1676283394,
@ -557,7 +610,7 @@
"wordsofgod": { "wordsofgod": {
"inputs": { "inputs": {
"naersk": "naersk_3", "naersk": "naersk_3",
"nixpkgs": "nixpkgs_10", "nixpkgs": "nixpkgs_11",
"utils": "utils_2" "utils": "utils_2"
}, },
"locked": { "locked": {

View file

@ -21,6 +21,7 @@
karton.url = "git+https://gitlab.com/obsidianical/microbin.git"; karton.url = "git+https://gitlab.com/obsidianical/microbin.git";
arion.url = "github:hercules-ci/arion"; arion.url = "github:hercules-ci/arion";
gumseite.url = "git+https://gitlab.com/schrottkatze/gum-schulsachen.git"; gumseite.url = "git+https://gitlab.com/schrottkatze/gum-schulsachen.git";
fenix.url = "github:nix-community/fenix";
}; };
outputs = { outputs = {
@ -31,10 +32,30 @@
home-manager, home-manager,
nixos-hardware, nixos-hardware,
mac-brcm-fw, mac-brcm-fw,
fenix,
... ...
} @ inputs: let } @ inputs: let
pkgs = nixpkgs.legacyPackages."x86_64-linux"; system = "x86_64-linux";
pkgs-unstable-small = nixpkgs-unstable-small.legacyPackages."x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system};
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
pkgs-unstable-small = nixpkgs-unstable-small.legacyPackages.${system};
rs-toolchain = with fenix.packages.${system};
combine [
default.toolchain
rust-analyzer
];
rs-platform = pkgs.makeRustPlatform {
cargo = rs-toolchain;
rustc = rs-toolchain;
};
rs-programs = final: prev: {
s10e-jrnl = rs-platform.buildRustPackage {
pname = "jrnl";
version = "0.0.1";
src = ./programs/jrnl;
cargoLock.lockFile = ./programs/jrnl/Cargo.lock;
};
};
in { in {
devShells."x86_64-linux".default = pkgs.mkShell { devShells."x86_64-linux".default = pkgs.mkShell {
buildInputs = [ buildInputs = [
@ -46,13 +67,14 @@
xmobar xmobar
statgrab statgrab
])) ]))
rs-toolchain
pkgs.haskell-language-server pkgs.haskell-language-server
]; ];
}; };
nixosConfigurations = { nixosConfigurations = {
monosodium-glutamate-g = nixpkgs.lib.nixosSystem { monosodium-glutamate-g = nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs pkgs-unstable-small; inherit inputs pkgs-unstable-small pkgs-stable rs-programs;
}; };
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
@ -74,7 +96,7 @@
}; };
catbook-j = nixpkgs.lib.nixosSystem { catbook-j = nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs pkgs-unstable-small; inherit inputs pkgs-unstable-small pkgs-stable rs-programs;
}; };
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
@ -96,7 +118,7 @@
}; };
potatobook-g = nixpkgs.lib.nixosSystem { potatobook-g = nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs pkgs-unstable-small; inherit inputs pkgs-unstable-small rs-programs;
}; };
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [

7
programs/jrnl/Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "jrnl"
version = "0.1.0"

6
programs/jrnl/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "jrnl"
version = "0.1.0"
edition = "2021"
[dependencies]

View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}