Skip to content

Commit 7541848

Browse files
midirhee12maningreen
midirhee12
authored andcommitted
feat: separate shell.nix and multiple systems
1 parent 38408a1 commit 7541848

File tree

3 files changed

+38
-19
lines changed

3 files changed

+38
-19
lines changed

flake.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,26 @@
88
ref = "nixos-unstable";
99
};
1010

11-
outputs = { self, nixpkgs }: let
12-
system = "x86_64-linux";
13-
pkgs = import nixpkgs { inherit system; };
14-
basePkgs = with pkgs; [
15-
poetry
16-
python313
11+
outputs = {
12+
self,
13+
nixpkgs,
14+
...
15+
}:
16+
let
17+
supportedSystems = [
18+
"x86_64-linux"
19+
"x86_64-darwin"
20+
"aarch64-linux"
21+
"aarch64-darwin"
22+
];
1723

18-
];
19-
in {
20-
devShells.${system}.default = pkgs.mkShell {
21-
packages = with pkgs; [
22-
] ++ basePkgs;
23-
shellHook = ''
24-
echo "Have fun developing :) - green"
25-
'';
26-
pkgs.${system}.default = pkgs.stdenv.mkDerivation {
27-
};
24+
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
25+
in {
26+
devShells = forAllSystems (system: let
27+
pkgs = nixpkgs.legacyPackages.${system};
28+
in {
29+
tux = pkgs.callPackage ./shell.nix { inherit pkgs; };
30+
default = self.devShells.${system}.tux;
31+
});
2832
};
29-
};
3033
}

shell.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{ pkgs ? import <nixpkgs> {} }:
2+
3+
pkgs.mkShell {
4+
packages = with pkgs; [
5+
python313
6+
poetry
7+
];
8+
9+
shellHook = ''
10+
# enters the user's preferred shell
11+
$(grep $USER /etc/passwd | sed 's|.*:||g' | tr -d '\n')
12+
13+
# exits after child shell exits
14+
exit
15+
'';
16+
}

0 commit comments

Comments
 (0)