Skip to content

Commit f96b8ac

Browse files
committed
feat: add nomad module
1 parent 4ad5a96 commit f96b8ac

File tree

15 files changed

+226
-27
lines changed

15 files changed

+226
-27
lines changed

flake-parts/devshell/default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
config,
1010
pkgs,
1111
system,
12+
inputs',
1213
...
1314
}: let
1415
pre-commit-check = import ./pre_commit.nix inputs system;
1516
in rec {
1617
devShells = {
1718
default = pkgs.mkShell {
18-
buildInputs = with pkgs; [alejandra inputs.home-manager.packages.${system}.home-manager];
19+
buildInputs = with pkgs; [alejandra inputs.home-manager.packages.${system}.home-manager hcloud];
1920
inherit (pre-commit-check) shellHook;
2021
};
2122
};

flake-parts/nixos_configurations.nix

+5-7
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@ in {
3232
type = lib.types.enum ["x86_64-linux" "aarch64-linux"];
3333
};
3434

35+
configDirectory = lib.mkOption {
36+
type = lib.types.str;
37+
default = "${self}/nixos/configurations/${name}";
38+
};
39+
3540
modules = lib.mkOption {
3641
type = lib.types.listOf lib.types.unspecified;
3742
default = [];
3843
description = "List of modules to include for the nixos configuration.";
3944
};
4045

41-
# outputs
42-
configDirectory = lib.mkOption {
43-
type = lib.types.str;
44-
readOnly = true;
45-
};
46-
4746
nixosConfig = lib.mkOption {
4847
type = lib.types.unspecified;
4948
readOnly = true;
@@ -91,7 +90,6 @@ in {
9190
};
9291

9392
config = {
94-
configDirectory = "${self}/nixos/configurations/${name}";
9593
entryPoint = import config.configDirectory (inputs // {inherit self;});
9694
bootloader = "${config.configDirectory}/bootloader.nix";
9795
hardware = "${config.configDirectory}/hardware.nix";

flake.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+3-4
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,17 @@
3939
} @ inputs:
4040
flake-parts.lib.mkFlake {inherit self;} {
4141
flake = {
42-
nixosModules = import ./nixos/modules inputs;
43-
4442
homeModules = import ./home/modules inputs;
45-
46-
modules = import ./modules inputs;
4743
};
4844
systems = ["x86_64-linux" "aarch64-linux"];
4945
imports = [
5046
./flake-parts
5147
./flake-parts/nixos_configurations.nix
5248
./flake-parts/home_configurations.nix
5349

50+
./nixos/modules
51+
./modules
52+
5453
./nixos/configurations
5554
./home/configurations
5655
];

home/configurations/default.nix

+11
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,16 @@ in {
2525
}
2626
];
2727
};
28+
29+
"justin@bunky" = {
30+
system = "x86_64-linux";
31+
modules =
32+
extraModules
33+
++ [
34+
{
35+
home.stateVersion = "21.11";
36+
}
37+
];
38+
};
2839
};
2940
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{comma, ...}: {pkgs, ...}: let
2+
in {
3+
config = {
4+
activeProfiles = ["development"];
5+
6+
home.packages = with pkgs; [
7+
comma.packages.x86_64-linux.default
8+
alejandra
9+
];
10+
11+
programs.zellij = {
12+
enable = true;
13+
settings = {
14+
default-shell = "zsh";
15+
};
16+
};
17+
};
18+
}

home/modules/profiles/development/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ in {
5555
cargo
5656
rustc
5757
rust-analyzer
58-
openscad
58+
# openscad
5959
statix
6060
cocogitto
6161
];

modules/default.nix

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1-
inputs: {
1+
{
2+
inputs,
3+
self,
4+
...
5+
}: {
6+
imports = [
7+
];
8+
9+
flake.modules = {
10+
};
211
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
boot.loader.systemd-boot.enable = true;
3+
boot.loader.efi.canTouchEfiVariables = true;
4+
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
5+
6+
boot.initrd.availableKernelModules = ["nvme" "ahci" "thunderbolt" "xhci_pci" "usb_storage" "usbhid" "sd_mod"];
7+
boot.initrd.kernelModules = ["amdgpu"];
8+
boot.kernelModules = ["kvm-amd"];
9+
boot.extraModulePackages = [];
10+
}
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{unixpkgs, ...} @ inputs: {
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}: {
7+
imports = [
8+
];
9+
10+
# Linux kernel
11+
boot = {
12+
# kernelPackages = pkgs.linuxKernel.packages.linux_6_0;
13+
kernelPackages = pkgs.linuxKernel.packages.linux_latest;
14+
supportedFilesystems = ["zfs" "ext4"];
15+
zfs.enableUnstable = true;
16+
};
17+
18+
# Enable networking
19+
networking.networkmanager.enable = true;
20+
21+
# Set your time zone.
22+
time.timeZone = "America/Chicago";
23+
24+
# Select internationalisation properties.
25+
i18n = {
26+
defaultLocale = "en_US.UTF-8";
27+
};
28+
29+
# Enable the X11 windowing system.
30+
services.xserver.enable = true;
31+
32+
# personal modules
33+
justinrubek = {
34+
development.containers = {
35+
enable = true;
36+
};
37+
};
38+
39+
# Define a user account. Don't forget to set a password with ‘passwd’.
40+
users.users = {
41+
justin = {
42+
isNormalUser = true;
43+
description = "Justin";
44+
extraGroups = ["networkmanager" "wheel" "docker"];
45+
shell = pkgs.zsh;
46+
};
47+
};
48+
49+
# Allow unfree packages
50+
nixpkgs.config.allowUnfree = true;
51+
52+
# List packages installed in system profile. To search, run:
53+
# $ nix search wget
54+
environment.systemPackages = with pkgs; [
55+
];
56+
57+
services.openssh = {
58+
enable = true;
59+
permitRootLogin = "no";
60+
};
61+
62+
# Open ports in the firewall.
63+
# networking.firewall.allowedTCPPorts = [ ... ];
64+
# networking.firewall.allowedUDPPorts = [ ... ];
65+
# Or disable the firewall altogether.
66+
# networking.firewall.enable = false;
67+
68+
# This value determines the NixOS release from which the default
69+
# settings for stateful data, like file locations and database versions
70+
# on your system were taken. It‘s perfectly fine and recommended to leavecatenate(variables, "bootdev", bootdev)
71+
# this value at the release version of the first install of this system.
72+
# Before changing this value read the documentation for this option
73+
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
74+
system.stateVersion = "22.11"; # Did you read the comment?
75+
76+
nix = {
77+
extraOptions = ''
78+
experimental-features = nix-command flakes
79+
'';
80+
};
81+
}
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
modulesPath,
6+
...
7+
}: {
8+
imports = [
9+
(modulesPath + "/installer/scan/not-detected.nix")
10+
];
11+
12+
fileSystems."/" = {
13+
device = "fpool/local/root";
14+
fsType = "zfs";
15+
};
16+
17+
fileSystems."/boot" = {
18+
device = "/dev/disk/by-uuid/D3E4-CF9F";
19+
fsType = "vfat";
20+
};
21+
22+
fileSystems."/nix" = {
23+
device = "fpool/local/nix";
24+
fsType = "zfs";
25+
};
26+
27+
fileSystems."/home" = {
28+
device = "fpool/safe/home";
29+
fsType = "zfs";
30+
};
31+
32+
fileSystems."/persist" = {
33+
device = "fpool/safe/persist";
34+
fsType = "zfs";
35+
};
36+
37+
# Required by zfs to exist
38+
networking.hostId = "deadbeef";
39+
40+
swapDevices = [];
41+
42+
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
43+
# (the default) this is the recommended approach. When using systemd-networkd it's
44+
# still possible to use this option, but it's recommended to use it in conjunction
45+
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
46+
networking.useDHCP = lib.mkDefault true;
47+
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
48+
49+
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
50+
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
51+
}

nixos/configurations/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ _: {
22
justinrubek.nixosConfigurations = {
33
manusya.system = "x86_64-linux";
44
eunomia.system = "x86_64-linux";
5+
bunky.system = "x86_64-linux";
56
};
67
}

nixos/configurations/eunomia/default.nix

-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ in {
4747

4848
development.containers = {
4949
enable = true;
50-
useDocker = true;
5150
};
5251
};
5352

@@ -89,7 +88,6 @@ in {
8988
system.stateVersion = "22.11"; # Did you read the comment?
9089

9190
nix = {
92-
package = pkgs.nixFlakes;
9391
extraOptions = ''
9492
experimental-features = nix-command flakes
9593
'';

nixos/modules/default.nix

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
inputs: {
2-
cachix = import ./cachix inputs;
3-
nix = import ./nix.nix inputs;
4-
flake = import ./flake.nix inputs;
5-
sound = import ./sound.nix inputs;
1+
{inputs, ...}: {
2+
flake.nixosModules = {
3+
cachix = import ./cachix inputs;
4+
nix = import ./nix.nix inputs;
5+
flake = import ./flake.nix inputs;
6+
sound = import ./sound.nix inputs;
67

7-
"windowing/xmonad" = import ./windowing/xmonad inputs;
8-
"windowing/plasma" = import ./windowing/plasma inputs;
8+
"windowing/xmonad" = import ./windowing/xmonad inputs;
9+
"windowing/plasma" = import ./windowing/plasma inputs;
910

10-
containers = import ./containers.nix inputs;
11+
containers = import ./containers.nix inputs;
12+
nomad = import ./nomad inputs;
13+
};
1114
}

nixos/modules/nomad/default.nix

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{...}: {
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}: let
7+
cfg = config.justinrubek.nomad;
8+
in {
9+
options.justinrubek.nomad = {
10+
enable = lib.mkEnableOption "run nomad";
11+
};
12+
13+
config = lib.mkIf cfg.enable {
14+
services.nomad = {
15+
enable = true;
16+
enableDocker = true;
17+
};
18+
};
19+
}

0 commit comments

Comments
 (0)