- Clone this repo
- For a new machine
- add new platform in directory under
./platform/<machine>
- make appropriate changes from
configuration.nix
andhadrware-configuration.nix
- add the machine to
flake.nix
- add new platform in directory under
- Run the
nixos-rebuild
:sudo nixos-rebuild switch --install-bootloader --flake .#<machine>
- Move
./confs
files to their appropriate locations
cd ~/somenix
sudo nix flake update
sudo nixos-rebuild switch --flake .#machine-name
cd ~/somenix
sudo nix-env -p /nix/var/nix/profiles/system --list-generations
cd ~/somenix
sudo nix-collect-garbage --delete-older-than 1d
sudo nixos-rebuild switch --flake .#machine-name
- Create a new file in packages directory.
- Add various contents that your heart pleases. This is necessary because your heart will bleed debugging it.
- Pray.
- Add the call in flake.nix.
- Use command
ix-build -E 'with import <nixpkgs> { }; callPackage ./packages/yourpackage.nix {}' --show-trace
- Run
result/bin/yourpackage
if it builds fine
You may need various SHAs. You will need to try many many things. As an example, look at nrfdfu.nix. It has two SHAs, one for fetchFromGitHub
and other for rustPlatform.buildRustPackage
.
> ERROR: cargoSha256 is out of date
>
> Cargo.lock is not the same in /build/nrfdfu-rs-v0.1.3-vendor.tar.gz
>
> To fix the issue:
> 1. Use "0000000000000000000000000000000000000000000000000000" as the cargoSha256 value
> 2. Build the derivation and wait for it to fail with a hash mismatch
> 3. Copy the 'got: sha256:' value back into the cargoSha256 field
>
Like using carghoHash
to cargoSha256
will give you better logs
nix-prefetch-url --unpack --type sha256 https://github.com/user/mypackage/archive/vx.y.z.tar.gz
You may need to convert the SHA256 into SRI format using this command
nix hash to-sri --type sha256 0784xz1svjfzsvcd0ghyrjqragvrasll674fn96hg660bv0df5gc
- Spacekookie for introducing me and giving me my first NixOS config to copy
- Ana, Hoverbear for showing me the light of Nix Flakes and giving me the setup to copy
- Graham on being in the NixOS community and constantly improving it
- NixOS folks who constantly improve things
- Friends of this land who help me out when I have questions