diff --git a/dev/rust/flake.lock b/dev/rust/flake.lock new file mode 100644 index 0000000..67281dc --- /dev/null +++ b/dev/rust/flake.lock @@ -0,0 +1,95 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688145808, + "narHash": "sha256-xtIi36kzfpjWM6zaR3nwV8quwi1c00H9uPLysG262XY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4586970ee7b8cc79a1dfb5dc938c839925138f67", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1688092301, + "narHash": "sha256-NTgT955DzXWVjHsuBn1t2K0x4hUghY7uE1jG2nGL5R4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "4c31223801dd0f28ac15d60f2e5ddbd4d51ce17a", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/dev/rust/flake.nix b/dev/rust/flake.nix new file mode 100644 index 0000000..5a06393 --- /dev/null +++ b/dev/rust/flake.nix @@ -0,0 +1,50 @@ +{ + description = "Rust development environment"; + + # Flake inputs + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; # also valid: "nixpkgs" + rust-overlay.url = "github:oxalica/rust-overlay"; # A helper for Rust + Nix + }; + + # Flake outputs + outputs = { self, nixpkgs, rust-overlay }: + let + # Overlays enable you to customize the Nixpkgs attribute set + overlays = [ + # Makes a `rust-bin` attribute available in Nixpkgs + (import rust-overlay) + # Provides a `rustToolchain` attribute for Nixpkgs that we can use to + # create a Rust environment + (self: super: { + rustToolchain = super.rust-bin.stable.latest.default; + }) + ]; + + # Systems supported + allSystems = [ + "x86_64-linux" # 64-bit Intel/AMD Linux + "aarch64-linux" # 64-bit ARM Linux + "x86_64-darwin" # 64-bit Intel macOS + "aarch64-darwin" # 64-bit ARM macOS + ]; + + # Helper to provide system-specific attributes + forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { + pkgs = import nixpkgs { inherit overlays system; }; + }); + in + { + # Development environment output + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + # The Nix packages provided in the environment + packages = (with pkgs; [ + # The package provided by our custom overlay. Includes cargo, Clippy, cargo-fmt, + # rustdoc, rustfmt, and other tools. + rustToolchain + ]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ libiconv ]); + }; + }); + }; +} diff --git a/nixos/modules/common.nix b/nixos/modules/common.nix index 8a5c0a6..fd3861b 100644 --- a/nixos/modules/common.nix +++ b/nixos/modules/common.nix @@ -71,10 +71,6 @@ extraGroups = [ "networkmanager" "wheel" ]; }; - # home-manager.users.daan = { pkgs, ... }: { - # imports = [ "./home" ]; - # }; - # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -92,11 +88,6 @@ helix firefox git - openssh - ]; - - hardware.opengl.extraPackages = with pkgs; [ - intel-media-driver ]; # Some programs need SUID wrappers, can be configured further or are diff --git a/nixos/systems/yoga/configuration.nix b/nixos/systems/yoga/configuration.nix index 564c476..4d90845 100644 --- a/nixos/systems/yoga/configuration.nix +++ b/nixos/systems/yoga/configuration.nix @@ -11,5 +11,10 @@ fileSystems."/nix".options = [ "compress=zstd" "noatime" ]; networking.hostName = "danacus-yoga"; # Define your hostname. + + # Intel GPU only: enable VAAPI + hardware.opengl.extraPackages = with pkgs; [ + intel-media-driver + ]; }