From 41b417309dba7e6a69c363d97a75af0b604f6a50 Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Mon, 30 Sep 2024 12:52:21 +0400 Subject: [PATCH] Add dev shells Signed-off-by: Nikolaos Karaolidis --- README.md | 1 + flake.lock | 34 +++++++++++++++++++ flake.nix | 20 +++++++++-- .../system/configs/printing/default.nix | 1 - hosts/common/system/shells/nix/default.nix | 12 +++++++ hosts/common/system/shells/python/default.nix | 8 +++++ 6 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 hosts/common/system/shells/nix/default.nix create mode 100644 hosts/common/system/shells/python/default.nix diff --git a/README.md b/README.md index 719756b..e7d8a73 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ NixOS dotfiles and configuration for various hosts and users. - [`system/`](./hosts/common/system): System-level configurations and scripts. - [`configs/`](./hosts/common/system/configs): System configurations applicable to all hosts. - [`scripts/`](./hosts/common/system/scripts): Utility scripts, such as `nix-cleanup`. + - [`shells/`](./hosts/common/system/shells): Nix dev shells. - [`user/`](./hosts/common/user): Per-user options. - [`configs/`](./hosts/common/user/configs): User configurations, split into: - [`console/`](./hosts/common/user/configs/console): Console-related settings. diff --git a/flake.lock b/flake.lock index 698a53e..5e4364d 100644 --- a/flake.lock +++ b/flake.lock @@ -57,6 +57,24 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -129,6 +147,7 @@ "inputs": { "ags": "ags", "disko": "disko", + "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nur": "nur", @@ -192,6 +211,21 @@ "repo": "default-linux", "type": "github" } + }, + "systems_2": { + "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", diff --git a/flake.nix b/flake.nix index fbc60df..e412467 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,10 @@ url = "github:nix-community/NUR"; }; + flake-utils = { + url = "github:numtide/flake-utils"; + }; + ags = { url = "github:Aylur/ags"; inputs.nixpkgs.follows = "nixpkgs"; @@ -68,7 +72,19 @@ modules = [ ./hosts/eirene ]; }; }; + } + // inputs.flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells = { + nix = import ./hosts/common/system/shells/nix { inherit pkgs; }; + python = import ./hosts/common/system/shells/python { inherit pkgs; }; + }; - formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; - }; + formatter = pkgs.nixfmt-rfc-style; + } + ); } diff --git a/hosts/common/system/configs/printing/default.nix b/hosts/common/system/configs/printing/default.nix index 135b3b4..05cb4fc 100644 --- a/hosts/common/system/configs/printing/default.nix +++ b/hosts/common/system/configs/printing/default.nix @@ -33,5 +33,4 @@ config.environment.persistence."/persist"."/var/lib/cups/printers.conf".mount ]; }; - } diff --git a/hosts/common/system/shells/nix/default.nix b/hosts/common/system/shells/nix/default.nix new file mode 100644 index 0000000..d85081c --- /dev/null +++ b/hosts/common/system/shells/nix/default.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +pkgs.mkShell { + packages = with pkgs; [ + nix + nil + nixpkgs-fmt + ]; + + shellHook = '' + exec $SHELL + ''; +} diff --git a/hosts/common/system/shells/python/default.nix b/hosts/common/system/shells/python/default.nix new file mode 100644 index 0000000..d5061bb --- /dev/null +++ b/hosts/common/system/shells/python/default.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +pkgs.mkShell { + packages = with pkgs; [ python3 ]; + + shellHook = '' + exec $SHELL + ''; +}