Skip to content

Commit

Permalink
feat(profile): add mars server configuration (#86)
Browse files Browse the repository at this point in the history
* feat(profile): add mars server configuration

* ci(justfile): add git add recipe

* patch(profile): remove console font settings

* patch(profile): add user packages
  • Loading branch information
piyoki authored Mar 3, 2024
1 parent 8e041c2 commit b7a75ce
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
nixosConfigurations = {
laptop = genSystem { profile = "thinkpad-x1-carbon"; };
desktop = genSystem { profile = "nuc-12"; };
mars = genSystem { profile = "mars"; };
};
};

Expand Down
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ prefetch-git repo rev:
# nix-collect-garbage
cleanup:
@sudo nix-collect-garbage -d

# stage all files
add:
@git add .
85 changes: 85 additions & 0 deletions profiles/mars/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).

{ config, lib, pkgs, ... }:

{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];

boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;

networking.networkmanager.enable = true;
networking.hostName = "nixos-mars";

time.timeZone = "Asia/Shanghai";
i18n.defaultLocale = "en_US.UTF-8";

environment.systemPackages = with pkgs; [
git
vim
neofetch
ripgrep
curl
wget
just
];

users.users = {
kev = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "docker"];
shell = pkgs.fish;
packages = with pkgs; [ fish ];
};

root = {
shell = pkgs.bash;
};
};
users.extraGroups.docker.members = [ "kev" ];

programs.fish.enable = true;

services.openssh = {
enable = true;
settings = {
PermitRootLogin = "no"; # disable root login
PasswordAuthentication = true; # disable password login
};
};

zramSwap.enable = true;

networking.firewall.allowedTCPPorts = [ 22 ];

environment.variables.EDITOR = "vim";

virtualisation.docker = {
enable = true;
enableOnBoot = true;
};

nix = {
settings = {
max-jobs = lib.mkDefault 8;
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];

};
gc = {
automatic = lib.mkDefault true;
dates = lib.mkDefault "weekly";
options = lib.mkDefault "--delete-older-than 1w";
};
};

system.stateVersion = "24.11";

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
59 changes: 59 additions & 0 deletions profiles/mars/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix") ];

boot.kernelPackages = pkgs.linuxPackages_latest;
boot.supportedFilesystems = [ "btrfs" ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

fileSystems."/" =
{ device = "/dev/disk/by-uuid/031752e4-b7af-4942-a62a-74650501fdb3";
fsType = "btrfs";
options = [ "noatime" "space_cache=v2" "compress=zstd" "ssd" "discard=async" "subvol=@" ];
};

fileSystems."/home" =
{ device = "/dev/disk/by-uuid/031752e4-b7af-4942-a62a-74650501fdb3";
fsType = "btrfs";
options = [ "noatime" "space_cache=v2" "compress=zstd" "ssd" "discard=async" "subvol=@home" ];
};

fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/031752e4-b7af-4942-a62a-74650501fdb3";
fsType = "btrfs";
options = [ "noatime" "space_cache=v2" "compress=zstd" "ssd" "discard=async" "subvol=@nix" ];
};

fileSystems."/snapshots" =
{ device = "/dev/disk/by-uuid/031752e4-b7af-4942-a62a-74650501fdb3";
fsType = "btrfs";
options = [ "noatime" "space_cache=v2" "compress=zstd" "ssd" "discard=async" "subvol=@snapshots" ];
};

fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/1E7C-94C1";
fsType = "vfat";
};

swapDevices = [ ];

# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;

hardware = {
# CPU
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
};
}
19 changes: 19 additions & 0 deletions profiles/mars/home.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ pkgs, ... }:

{
imports = [
# default home modules
../../shared/home.nix

# host specific modules

# shared modules
];

home.packages = with pkgs; [
bat
delta
jq
lazygit
];
}

0 comments on commit b7a75ce

Please sign in to comment.