Skip to content

Commit

Permalink
use default.nix for building
Browse files Browse the repository at this point in the history
  • Loading branch information
cyber-murmel committed Apr 26, 2022
1 parent 9c0e8d0 commit a6f34d0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ Set `BOARD_TYPE` to the desired value and run the command as shown below.
$ export BOARD_TYPE=foobar
# nixpkgs pinned to master as of Thu Mar 31 08:01:29 2022 -0700
$ export NIXPKGS="https://github.com/NixOS/nixpkgs/archive/3e481ad.tar.gz"
$ nix-build '<nixpkgs/nixos>' \
-A config.system.build.sdImage \
-I nixpkgs=$NIXPKGS \
-I nixos-config=./sd-image.nix \
-I machine=machines/$BOARD_TYPE \
--out-link out-links/$BOARD_TYPE
$ nix-build -I nixpkgs=$NIXPKGS -I machine=machines/$BOARD_TYPE --out-link out-links/$BOARD_TYPE
```
### Boards
`BOARD_TYPE` can be set to the name of any directory in `machines`.
Expand All @@ -35,12 +30,7 @@ $ export NIXPKGS=https://github.com/NixOS/nixpkgs/archive/3e481ad.tar.gz
$ for machine in $(find machines -maxdepth 1 -mindepth 1 -type d)
do
export BOARD_TYPE=$(basename $machine);
nix-build '<nixpkgs/nixos>' \
-A config.system.build.sdImage \
-I nixpkgs=$NIXPKGS \
-I nixos-config=./sd-image.nix \
-I machine=machines/$BOARD_TYPE \
--out-link out-links/$BOARD_TYPE
nix-build -I nixpkgs=$NIXPKGS -I machine=machines/$BOARD_TYPE --out-link out-links/$BOARD_TYPE
done
```

Expand Down
15 changes: 15 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let
lib = import <nixpkgs/lib>;
nixos = import <nixpkgs/nixos> {
configuration = { ... }: {
imports = [
<machine/sd-image.nix>
<machine/hardware-configuration.nix>
./nixos/configuration.nix
] ++ lib.optionals (builtins.pathExists ./custom.nix) [ ./custom.nix ];
};
};
in
nixos.config.system.build.sdImage // {
inherit (nixos) pkgs system config;
}
8 changes: 0 additions & 8 deletions sd-image.nix

This file was deleted.

0 comments on commit a6f34d0

Please sign in to comment.