Skip to content

Commit afa08f3

Browse files
committed
psx
1 parent 4421358 commit afa08f3

File tree

4 files changed

+101
-8
lines changed

4 files changed

+101
-8
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
/.vscode/settings.json
2+
/.last_build.txt
3+
4+
/result
5+
/_utm

Makefile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
TARGET = bato-nix
2+
3+
BUILD_STORE = wsl-proxy-vm
4+
BUILD_OUT_FILE = .last_build.txt
5+
6+
.PHONY: %
7+
8+
qcow: qcow-build qcow-copy
9+
10+
#time nix build .#nixosConfigurations.$(TARGET).config.formats.qcow --eval-store auto --store 'ssh-ng://$(BUILD_STORE)' --json -L | tee $(BUILD_OUT_FILE); exit "$${PIPESTATUS[0]}"
11+
# IMG_PATH=$(shell cat $(BUILD_OUT_FILE) | jq .[].outputs.out -r ); [ ! -z "$$IMG_PATH" ] && time scp $(BUILD_STORE):"$$IMG_PATH/"*.qcow2 ./"$(TARGET).qcow2"
12+
#time nix build .#nixosConfigurations.$(TARGET).config.formats.qcow --eval-store auto --json -L | tee $(BUILD_OUT_FILE); exit "$${PIPESTATUS[0]}"
13+
qcow-build: ensure-target
14+
time nix build .#nixosConfigurations.$(TARGET).config.formats.qcow --json -L | tee $(BUILD_OUT_FILE); exit "$${PIPESTATUS[0]}"
15+
qcow-copy: ensure-target
16+
[ -f "./result/nixos.qcow2" ] && rm -f ./_utm/"$(TARGET).qcow2" && time cp -L "./result/nixos.qcow2" ./_utm/"$(TARGET).qcow2"
17+
18+
################################################################################
19+
# Helpers
20+
################################################################################
21+
22+
ensure-target:
23+
ifndef TARGET
24+
$(error TARGET is undefined)
25+
endif

flake.nix

+54-8
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,58 @@
1313
};
1414

1515
outputs = { self, nixpkgs, flake-utils, nixos-generators }:
16-
flake-utils.lib.eachDefaultSystem (system:
17-
let
18-
pkgs = nixpkgs.legacyPackages.${system};
19-
in
20-
{
21-
devShell = import ./shell.nix { inherit pkgs; };
22-
}
23-
);
16+
flake-utils.lib.eachDefaultSystem
17+
(eachSystem:
18+
let
19+
pkgs = nixpkgs.legacyPackages.${eachSystem};
20+
in
21+
{
22+
devShell = import ./shell.nix { inherit pkgs; };
23+
}
24+
) // {
25+
nixosConfigurations =
26+
let
27+
bato-system = "x86_64-linux";
28+
stateVersion = "23.11";
29+
in
30+
{
31+
bato-nix =
32+
let
33+
in nixpkgs.lib.nixosSystem rec {
34+
system = bato-system;
35+
36+
pkgs = import nixpkgs {
37+
inherit system;
38+
39+
config.allowUnfree = true;
40+
};
41+
42+
modules = [
43+
{
44+
system.stateVersion = stateVersion;
45+
boot.kernelPackages = pkgs.linuxPackages_6_6;
46+
users.users.root.password = "linux";
47+
48+
time.timeZone = "UTC";
49+
}
50+
51+
{
52+
imports = [
53+
nixos-generators.nixosModules.all-formats
54+
];
55+
56+
formatConfigs.qcow = { config, lib, ... }: { };
57+
}
58+
59+
{
60+
imports = [
61+
./profiles/systems/psx.nix
62+
];
63+
64+
bato.systems.psx.enable = true;
65+
}
66+
];
67+
};
68+
};
69+
};
2470
}

profiles/systems/psx.nix

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{ config, pkgs, lib, ... }:
2+
3+
let
4+
cfg = config.bato.systems.psx;
5+
in
6+
{
7+
options = {
8+
bato.systems.psx = {
9+
enable = lib.mkEnableOption (lib.mdDoc "Playstation 1");
10+
};
11+
};
12+
13+
config = lib.mkIf cfg.enable {
14+
environment.systemPackages = [
15+
pkgs.duckstation
16+
];
17+
};
18+
}

0 commit comments

Comments
 (0)