Skip to content

Commit f1052a7

Browse files
bors[bot]Mic92
andauthored
Merge #41
41: expose nixos-remote tools in devshell + envrc r=Mic92 a=Mic92 Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
2 parents 35db719 + d2f7012 commit f1052a7

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,17 @@ nixos-remote \
8181
--flake 'your-flake#your-system' \
8282
root@yourip
8383
```
84+
85+
## Developer guide
86+
87+
To run `nixos-remote` from the repo:
88+
89+
```console
90+
nix run . -- --help
91+
```
92+
93+
To format the code
94+
95+
```console
96+
nix fmt
97+
```

src/default.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
, coreutils
77
, curl
88
}:
9-
writeShellApplication {
10-
name = "nixos-remote";
11-
text = builtins.readFile ./nixos-remote.sh;
9+
let
1210
runtimeInputs = [
1311
openssh
1412
gitMinimal # for git flakes
@@ -17,4 +15,12 @@ writeShellApplication {
1715
coreutils
1816
curl # when uploading tarballs
1917
];
18+
in
19+
(writeShellApplication {
20+
name = "nixos-remote";
21+
text = builtins.readFile ./nixos-remote.sh;
22+
inherit runtimeInputs;
23+
}) // {
24+
# also expose this attribute to other derivations
25+
inherit runtimeInputs;
2026
}

src/flake-module.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
perSystem = { pkgs, ... }: {
3-
packages = rec {
2+
perSystem = { config, pkgs, ... }: {
3+
packages = {
44
nixos-remote = pkgs.callPackage ./. { };
5-
default = nixos-remote;
5+
default = config.packages.nixos-remote;
6+
};
7+
devShells.default = pkgs.mkShellNoCC {
8+
packages = config.packages.nixos-remote.runtimeInputs;
69
};
710
};
811
}

0 commit comments

Comments
 (0)