Skip to content

Commit

Permalink
fix(nixos): lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tyriis committed Mar 13, 2024
1 parent d5fd736 commit db3fa64
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 135 deletions.
72 changes: 39 additions & 33 deletions infra/nixos/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,44 @@
};

outputs = { self, nixpkgs, unstable, home-manager }:
let
overlay = final: prev: let
unstablePkgs = import unstable { inherit (prev) system; config.allowUnfree = true; };
in {
unstable = unstablePkgs;
};
# Overlays-module makes "pkgs.unstable" available in configuration.nix
overlayModule = ({ config, pkgs, ... }: {
nixpkgs.overlays = [ overlay ];
});
# To generate host configurations for all hosts.
hostnames = builtins.attrNames (builtins.readDir ./hosts);
in {
nixosConfigurations = builtins.listToAttrs (builtins.map (host: {
name = host;
value = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs.channels = { inherit nixpkgs unstable; };
modules = [
overlayModule
./hosts/${host}/configuration.nix
let
overlay = final: prev:
let
unstablePkgs = import unstable { inherit (prev) system; config.allowUnfree = true; };
in
{
unstable = unstablePkgs;
};
# Overlays-module makes "pkgs.unstable" available in configuration.nix
overlayModule = ({ config, pkgs, ... }: {
nixpkgs.overlays = [ overlay ];
});
# To generate host configurations for all hosts.
hostnames = builtins.attrNames (builtins.readDir ./hosts);
in
{
nixosConfigurations = builtins.listToAttrs (builtins.map
(host: {
name = host;
value = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs.channels = { inherit nixpkgs unstable; };
modules = [
overlayModule
./hosts/${host}/configuration.nix

# make home-manager as a module of nixos
# so that home-manager configuration will be deployed automatically when executing `nixos-rebuild switch`
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nils = import ./home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to home.nix
}
];
};
}) hostnames);
};
# make home-manager as a module of nixos
# so that home-manager configuration will be deployed automatically when executing `nixos-rebuild switch`
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nils = import ./home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to home.nix
}
];
};
})
hostnames);
};
}
10 changes: 5 additions & 5 deletions infra/nixos/fonts.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{pkgs, ...}: {
{ pkgs, ... }: {
# all fonts are linked to /nix/var/nix/profiles/system/sw/share/X11/fonts
fonts = {
# use fonts specified by user rather than default ones
Expand Down Expand Up @@ -31,10 +31,10 @@
# the reason there's Noto Color Emoji everywhere is to override DejaVu's
# B&W emojis that would sometimes show instead of some Color emojis
fontconfig.defaultFonts = {
serif = [ "DejaVu Serif" "Noto Color Emoji"];
sansSerif = [ "Noto Sans" "Noto Color Emoji"];
monospace = [ "DejaVu Sans Mono" "Noto Color Emoji"];
emoji = ["Noto Color Emoji"];
serif = [ "DejaVu Serif" "Noto Color Emoji" ];
sansSerif = [ "Noto Sans" "Noto Color Emoji" ];
monospace = [ "DejaVu Sans Mono" "Noto Color Emoji" ];
emoji = [ "Noto Color Emoji" ];
};
};
}
6 changes: 3 additions & 3 deletions infra/nixos/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
# networking tools
mtr # A network diagnostic tool
iperf3
dnsutils # `dig` + `nslookup`
dnsutils # `dig` + `nslookup`
ldns # replacement of `dig`, it provide the command `drill`
aria2 # A lightweight multi-protocol & multi-source command-line download utility
socat # replacement of openbsd-netcat
nmap # A utility for network discovery and security auditing
ipcalc # it is a calculator for the IPv4/v6 addresses
ipcalc # it is a calculator for the IPv4/v6 addresses

# misc
# cowsay
Expand All @@ -77,7 +77,7 @@
glow # markdown previewer in terminal

htop
btop # replacement of htop/nmon
btop # replacement of htop/nmon
iotop # io monitoring
iftop # network monitoring

Expand Down
127 changes: 64 additions & 63 deletions infra/nixos/hosts/dell/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# in
{
imports =
[ # Include the results of the hardware scan.
[
# Include the results of the hardware scan.
./hardware-configuration.nix
../../users.nix
../../fonts.nix
Expand Down Expand Up @@ -40,7 +41,7 @@
networking.hostName = "dell";
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.

# Set your time zone.
time.timeZone = "Europe/Vienna";
Expand All @@ -67,37 +68,37 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# # Enable i3
# services.xserver = {
# enable = true;
# layout = "de";
#
# desktopManager = {
# xterm.enable = false;
# xfce = {
# enable = true;
# noDesktop = true;
# enableXfwm = false;
# };
# };
#
# displayManager = {
# defaultSession = "xfce+i3";
# };
#
# windowManager.i3 = {
# enable = true;
# extraPackages = with pkgs; [
# dmenu #application launcher most people use
# rofi # dmenu but better ;)
# i3status # gives you the default i3 status bar
# i3lock #default i3 screen locker
# betterlockscreen # some better lockscreen
# i3blocks #if you are planning on using i3blocks over i3status
# # i3blocks-contrib
# ];
# };
# };
# # Enable i3
# services.xserver = {
# enable = true;
# layout = "de";
#
# desktopManager = {
# xterm.enable = false;
# xfce = {
# enable = true;
# noDesktop = true;
# enableXfwm = false;
# };
# };
#
# displayManager = {
# defaultSession = "xfce+i3";
# };
#
# windowManager.i3 = {
# enable = true;
# extraPackages = with pkgs; [
# dmenu #application launcher most people use
# rofi # dmenu but better ;)
# i3status # gives you the default i3 status bar
# i3lock #default i3 screen locker
# betterlockscreen # some better lockscreen
# i3blocks #if you are planning on using i3blocks over i3status
# # i3blocks-contrib
# ];
# };
# };


# Enable the Plasma 5 Desktop Environment.
Expand Down Expand Up @@ -128,35 +129,35 @@
# };

# users.users.nils = {
# isNormalUser = true;
# createHome = true;
# home = "/home/nils";
# extraGroups = [ "wheel" "networkmanager" "audio"];
# openssh.authorizedKeys.keys = let
# authorizedKeys = pkgs.fetchurl {
# url = "https://github.com/tyriis.keys";
# sha256 = "HQJOzIzdTcapfYRMueESfmlWGaylteMBLU8AqqwMTS4=";
# };
# in pkgs.lib.splitString "\n" (builtins.readFile authorizedKeys);
# packages = with pkgs; [
# go-task
# chezmoi
# vault
# age
# sops
# zsh
# zsh-autosuggestions
# zsh-syntax-highlighting
# spaceship-prompt
# nodePackages.zx
# unstable.vscode
# # tabby ;(
# barrier
# fluxcd
# kubectl
# kubernetes-helm
# k9s
# ];
# isNormalUser = true;
# createHome = true;
# home = "/home/nils";
# extraGroups = [ "wheel" "networkmanager" "audio"];
# openssh.authorizedKeys.keys = let
# authorizedKeys = pkgs.fetchurl {
# url = "https://github.com/tyriis.keys";
# sha256 = "HQJOzIzdTcapfYRMueESfmlWGaylteMBLU8AqqwMTS4=";
# };
# in pkgs.lib.splitString "\n" (builtins.readFile authorizedKeys);
# packages = with pkgs; [
# go-task
# chezmoi
# vault
# age
# sops
# zsh
# zsh-autosuggestions
# zsh-syntax-highlighting
# spaceship-prompt
# nodePackages.zx
# unstable.vscode
# # tabby ;(
# barrier
# fluxcd
# kubectl
# kubernetes-helm
# k9s
# ];
# };

# List packages installed in system profile. To search, run:
Expand Down Expand Up @@ -230,7 +231,7 @@
system.stateVersion = "23.11"; # Did you read the comment?

hardware.pulseaudio.enable = true;
hardware.pulseaudio.support32Bit = true; ## If compatibility with 32-bit applications is desired.
hardware.pulseaudio.support32Bit = true; ## If compatibility with 32-bit applications is desired.
nixpkgs.config.pulseaudio = true;

}
21 changes: 14 additions & 7 deletions infra/nixos/hosts/dell/hardware-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
[
(modulesPath + "/installer/scan/not-detected.nix")
];

boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
Expand All @@ -14,39 +15,45 @@
boot.extraModulePackages = [ ];

fileSystems."/" =
{ device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
{
device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" ];
};

boot.initrd.luks.devices."luks".device = "/dev/disk/by-uuid/af9f5709-104c-4060-8ec6-a5cafa0dff2f";

fileSystems."/home" =
{ device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
{
device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
fsType = "btrfs";
options = [ "subvol=home" "compress=zstd" "noatime" ];
};

fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
{
device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" ];
};

fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
{
device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
fsType = "btrfs";
options = [ "subvol=persist" "compress=zstd" "noatime" ];
};

fileSystems."/var/log" =
{ device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
{
device = "/dev/disk/by-uuid/af069821-57f2-4cae-92ab-0a104ea684fa";
fsType = "btrfs";
options = [ "subvol=log" "compress=zstd" "noatime" ];
};

fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/11D4-E738";
{
device = "/dev/disk/by-uuid/11D4-E738";
fsType = "vfat";
};

Expand Down
Loading

0 comments on commit db3fa64

Please sign in to comment.