Skip to content

Commit a945bb1

Browse files
committed
shells: refactor to exclude neovim
1 parent b384e21 commit a945bb1

File tree

7 files changed

+58
-91
lines changed

7 files changed

+58
-91
lines changed

flake.nix

+8-3
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,17 @@
4545
};
4646
};
4747

48-
outputs = { nixpkgs, home-manager, stylix, nvim, ... } @ inputs:
48+
outputs = { self, nixpkgs, home-manager, stylix, nvim, ... } @ inputs:
4949
let
50-
inherit (nixpkgs) lib;
50+
lib = builtins // nixpkgs.lib;
5151

5252
forSystem = system: f: f {
5353
inherit lib;
5454
pkgs = import nixpkgs {
5555
inherit system;
5656
config.allowUnfree = true;
5757
overlays = [
58+
self.overlays.default
5859
nvim.overlays.default
5960
(final: prev: {
6061
firefox-addons = inputs.firefox-addons.packages.${system};
@@ -90,7 +91,9 @@
9091
};
9192
in
9293
{
93-
devShells = forEachSystem (import ./shells);
94+
devShells = forEachSystem (args: lib.mapAttrs'
95+
(name: _: lib.nameValuePair (lib.removeSuffix ".nix" name) (import ./shells/${name} args))
96+
(lib.readDir ./shells));
9497

9598
nixosConfigurations = {
9699
# Thinkpad X1 Carbon 5th Gen
@@ -100,5 +103,7 @@
100103
};
101104

102105
homeConfigurations = forEachSystem homeConfig;
106+
107+
overlays = import ./overlays;
103108
};
104109
}

home/nix.nix

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
{ pkgs, ... }:
22

33
{
4-
home.shellAliases = {
5-
nd = "nom develop";
6-
};
4+
home = {
5+
packages = with pkgs; [
6+
cachix
7+
nix-output-monitor
8+
];
9+
10+
shellAliases = rec {
11+
nd = "nom develop";
12+
13+
nf = "nix flake";
14+
nfc = "${nf} check";
15+
nfs = "${nf} show";
16+
nfu = "${nf} update";
717

8-
home.packages = with pkgs; [
9-
nix-output-monitor
10-
];
18+
nor = "sudo nixos-rebuild --flake .";
19+
norb = "${nr} boot |& nom";
20+
nors = "${nr} switch |& nom";
21+
nort = "${nr} test |& nom";
22+
23+
nr = "nix run";
24+
};
25+
};
1126
}

overlays/default.nix

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
default = final: prev: rec {
3+
writeAliasBin = alias: command:
4+
final.writeShellScriptBin alias ''
5+
exec ${command} "$@"
6+
'';
7+
writeAliasScripts = aliases: final.lib.mapAttrsToList writeAliasBin aliases;
8+
};
9+
}

shells/default.nix

+10-21
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
1-
{ pkgs, lib, ... } @ args:
1+
{ pkgs, ... } @ args:
22

33
let
4-
mkScript = alias: command:
5-
pkgs.writeShellScriptBin alias ''
6-
exec ${command} "$@"
7-
'';
8-
mkShell =
9-
{ aliases ? { }
10-
, nativeBuildInputs ? [ ]
11-
, packages ? [ ]
12-
, shellHook ? ""
13-
,
14-
}:
15-
pkgs.mkShell {
16-
inherit nativeBuildInputs shellHook;
17-
packages = packages ++ (lib.mapAttrsToList mkScript aliases);
18-
};
4+
aliases = rec {
5+
nr = "sudo nixos-rebuild --flake .";
6+
nrb = "${nr} boot |& nom";
7+
nrs = "${nr} switch |& nom";
8+
nrt = "${nr} test |& nom";
9+
};
1910
in
20-
lib.mapAttrs (name: path: mkShell ((import path) args)) rec {
21-
deno = ./deno.nix;
22-
ebiten = ./ebiten.nix;
23-
nix = ./nix.nix;
24-
default = nix;
11+
pkgs.mkShellNoCC {
12+
packages = (pkgs.writeAliasScripts aliases);
13+
inputsFrom = [ (import ./nix.nix args) ];
2514
}

shells/deno.nix

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
11
{ pkgs, ... }:
22

33
let
4-
inherit (pkgs) mkNeovim;
5-
6-
neovim = mkNeovim {
7-
modules = with mkNeovim.modules; [
8-
core
9-
clipboard
10-
copilot
11-
deno
12-
];
13-
};
14-
in
15-
{
164
aliases = rec {
17-
nv = "nvim";
18-
195
dt = "deno task";
206
dtr = "${dt} run";
217
dtt = "${dt} test";
228
};
9+
in
10+
pkgs.mkShellNoCC {
2311
packages = with pkgs; [
2412
deno
25-
neovim
26-
];
13+
] ++ (pkgs.writeAliasScripts aliases);
2714
}

shells/ebiten.nix

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
{ pkgs, ... }:
1+
{ pkgs, lib, ... }:
22

3-
let
4-
inherit (pkgs) mkNeovim;
5-
inherit (pkgs.lib) getLib;
6-
7-
neovim = mkNeovim {
8-
modules = with mkNeovim.modules; [
9-
core
10-
clipboard
11-
copilot
12-
];
13-
};
14-
in
15-
{
3+
pkgs.mkShell {
164
nativeBuildInputs = with pkgs; [
175
libGL
186
xorg.libX11
@@ -25,10 +13,9 @@ in
2513

2614
packages = with pkgs; [
2715
go
28-
neovim
2916
];
3017

3118
shellHook = ''
32-
export LD_LIBRARY_PATH=${pkgs.wayland}/lib:${getLib pkgs.libGL}/lib:$LD_LIBRARY_PATH
19+
export LD_LIBRARY_PATH=${pkgs.wayland}/lib:${lib.getLib pkgs.libGL}/lib:$LD_LIBRARY_PATH
3320
'';
3421
}

shells/nix.nix

+4-29
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,8 @@
1-
{ pkgs, ... }:
1+
{ pkgs, ... } @ args:
22

33
let
4-
neovim = pkgs.mkNeovim {
5-
modules = with pkgs.mkNeovim.modules; [
6-
core
7-
clipboard
8-
copilot
9-
nix
10-
];
11-
};
4+
home = (import ../home/nix.nix args).home;
125
in
13-
{
14-
aliases = rec {
15-
nf = "nix flake";
16-
nfc = "${nf} check";
17-
nfs = "${nf} show";
18-
nfu = "${nf} update";
19-
20-
nr = "sudo nixos-rebuild --flake .";
21-
nrb = "${nr} boot |& nom";
22-
nrs = "${nr} switch |& nom";
23-
nrt = "${nr} test |& nom";
24-
25-
nv = "nvim";
26-
};
27-
28-
packages = with pkgs; [
29-
cachix
30-
neovim
31-
nix-output-monitor
32-
];
6+
pkgs.mkShellNoCC {
7+
packages = home.packages ++ (pkgs.writeAliasScripts home.shellAliases);
338
}

0 commit comments

Comments
 (0)