Skip to content

Commit 08109c3

Browse files
committed
Fix #116: trusted-users allows running commands as root without password
Update `README.md` to rather suggest user to directly put the `extra-substituters` in `/etc/nix/nix.conf` and remove `nixConfig` attribute from the `flake.nix`.
1 parent 9a480f9 commit 08109c3

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

README.md

+27-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
11
# The Developer Experience Shell
22

3-
This repo contains a `nix develop` shell for haskell. Its primary purpose is to
4-
help get a development shell for haskell quickly and across multiple
3+
This repository contains a `nix develop` shell for Haskell. Its primary purpose
4+
is to help get a development shell for Haskell quickly and across multiple
55
operating systems (and architectures).
66

77
It requires [`nix` to be installed](https://nixos.org/download.html).
88

9-
Once you have `nix` installed, you can check that everything is working correctly:
10-
* Make sure to add `experimental-features = nix-command flakes` and `accept-flake-config = true` lines to `$XDG_CONFIG_HOME/nix/nix.conf` file ;
11-
* Make sure your `$USER` is trusted `nix show-config | grep trusted-users`, otherwise add it to `/etc/nix/nix.conf` and restart `nix-daemon` ;
12-
* Make sure the `nix-daemon` is running using `systemctl status nix-daemon` (if your OS is `systemd`-based).
13-
14-
Once you have `nix`, (Linux, macOS, windows WSL) you can use:
9+
> :warning: **Warning**
10+
> The README previously suggested to add your current user to `trusted-users`,
11+
> but this is essentially equivalent to giving that user root access to the
12+
> system.
13+
14+
## Getting Started
15+
16+
Once you have `nix` installed:
17+
- Add `experimental-features = nix-command flakes` to your
18+
`$XDG_CONFIG_HOME/nix/nix.conf` file to enable Nix flakes.
19+
- You should manually add necessary substituters and trusted public keys to your
20+
`/etc/nix/nix.conf`:
21+
```
22+
extra-substituters = https://cache.iog.io https://cache.zw3rk.com
23+
extra-trusted-public-keys = "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" "loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="
24+
```
25+
- Ensure that `nix-daemon` is running (`systemctl status nix-daemon` on
26+
`systemd`-based systems).
27+
28+
Then, (on Linux, macOS, windows WSL) you can use:
1529
```bash
1630
nix develop github:input-output-hk/devx#ghc96 --no-write-lock-file --refresh
1731
```
1832

19-
Then, to obtain a haskell development shell for GHC 8.10.7 including `cabal-install`,
20-
as well as `hls` and `hlint`. If you are on macOS on an Apple Silicon chip (M1, M2, ...),
21-
and want to switch between Intel (x86_64) and Apple Silicon (aarch64), you can do
22-
this by simply passing the corresponding `--system` argument:
33+
To obtain a haskell development shell for GHC 8.10.7 including `cabal-install`,
34+
as well as `hls` and `hlint`. If you are on macOS on an Apple Silicon chip
35+
(M1, M2, ...), and want to switch between Intel (x86_64) and Apple Silicon
36+
(aarch64), you can do this by simply passing the corresponding
37+
`--system` argument:
2338
```bash
2439
nix develop github:input-output-hk/devx#ghc810 --no-write-lock-file --refresh --system x86_64-darwin
2540
# ... or:

flake.nix

-16
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,4 @@
230230
} "touch $out";
231231
};
232232
};
233-
234-
# --- Flake Local Nix Configuration ----------------------------
235-
nixConfig = {
236-
extra-substituters = [
237-
"https://cache.iog.io"
238-
# We only have zw3rk cache in here, because it provide aarch64-linux and aarch64-darwin.
239-
"https://cache.zw3rk.com"
240-
];
241-
extra-trusted-public-keys = [
242-
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
243-
"loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="
244-
];
245-
# post-build-hook = "./upload-to-cache.sh";
246-
allow-import-from-derivation = "true";
247-
};
248-
# --------------------------------------------------------------
249233
}

0 commit comments

Comments
 (0)