This commit is contained in:
2025-10-27 00:02:33 +09:00
commit 3a0ef477f7
15 changed files with 399 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
/*
!.gitignore
!README.md
!LICENSE
!/flake.nix
!/flake.lock
!/hosts/
!/modules/
!/home-manager/
!/shells/
Generated
+134
View File
@@ -0,0 +1,134 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1758463745,
"narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.05",
"repo": "home-manager",
"type": "github"
}
},
"impermanence": {
"locked": {
"lastModified": 1737831083,
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1760958188,
"narHash": "sha256-2m1S4jl+GEDtlt2QqeHil8Ny456dcGSKJAM7q3j/BFU=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "d6645c340ef7d821602fd2cd199e8d1eed10afbc",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1761173472,
"narHash": "sha256-m9W0dYXflzeGgKNravKJvTMR4Qqa2MVD11AwlGMufeE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c8aa8cc00a5cb57fada0851a038d35c08a36a2bb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1761349956,
"narHash": "sha256-tH3wHnOJms+U4k/rK2Nn1RfBrhffX92jLP/2VndSn0w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "02f2cb8e0feb4596d20cc52fda73ccee960e3538",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1760596604,
"narHash": "sha256-J/i5K6AAz/y5dBePHQOuzC7MbhyTOKsd/GLezSbEFiM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3cbe716e2346710d6e1f7c559363d14e11c32a43",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"impermanence": "impermanence",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"sops-nix": "sops-nix"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1760998189,
"narHash": "sha256-ee2e1/AeGL5X8oy/HXsZQvZnae6XfEVdstGopKucYLY=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "5a7d18b5c55642df5c432aadb757140edfeb70b3",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
+66
View File
@@ -0,0 +1,66 @@
{
description = "Multi host Nix(OS) + Home Manager + flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
home-manager.url = "github:nix-community/home-manager/release-25.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
impermanence.url = "github:nix-community/impermanence";
};
outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager, sops-nix, impermanence, ...}:
let
mkSystem = { host, system, extraModules ? [ ] }:
let
pkgsUnstable = import nixpkgs-unstable { inherit system; config.allowUnfree = true; };
in
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs pkgsUnstable;
};
modules = [
# host config
./hosts/${host}/default.nix
# Home Manager
home-manager.nixosModules.home-manager
{ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; }
# common NixOS module
./modules/nixos/base.nix
./modules/nixos/cli.nix
./modules/nixos/sops.nix
./modules/nixos/impermanence.nix
] ++ extraModules;
};
in {
nixosConfigurations = {
x1g9 = mkSystem {
host = "x1g9";
system = "x86_64-linux";
extraModules = [
# X1 Carbon Gen 9 Hardware Profile
nixos-hardware.nixosModules.lenovo-thinkpad-x1-9th-gen
# GUI and x1g9 only App
./modules/nixos/desktop.nix
];
};
dev-server = mkSystem {
host = "dev-server";
system = "x86_64-linux";
};
};
devShells = {
x86_64-linux = {
next-web = import ./shells/next-web.nix { pkgs = import nixpkgs { system = "x86_64-linux"; }; };
};
};
};
}
+4
View File
@@ -0,0 +1,4 @@
{ ... } :
{
home.sessionVariables.BROWSER = "google-chrome-stable";
}
+14
View File
@@ -0,0 +1,14 @@
{ pkgs, lib, config, ... }:
let
isDrawin = pkgs.stdenv.isDrawin;
in
{
home.username = "moons";
home.homeDirectory = lib.mkDefault (if isDrawin then "/Users/moons" else "/home/moons");
programs.home-manager.enable = true;
home.stateVersion = "25.05";
imports = [
../../modules/hm/cli.nix
];
}
+28
View File
@@ -0,0 +1,28 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, lib, ... }:
{
imports =
[
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Define your hostname.
networking.hostName = "x1g9";
home-manager.users.moons = {
imports = [
../../home-manager/moons/default.nix
../../modules/hm/gui.nix
../../home-manager/hosts/x1g9.nix
];
};
}
+38
View File
@@ -0,0 +1,38 @@
# 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 + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/41636b9d-4d0d-4f4f-9f24-946041653d49";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/DE18-74DC";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
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.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+16
View File
@@ -0,0 +1,16 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
htop
git
];
programs.zsh.enable = true;
programs.git = {
enable = true;
userName = "moons-14";
userEmail = "moons@moons14.com";
extraConfig = { init.defaultBranch = "main"; };
};
}
+12
View File
@@ -0,0 +1,12 @@
{ pkgs, ... }:
{
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
esbenp.prettier-vscode
];
userSettings = {
"editor.formatOnSave" = true;
};
};
}
+19
View File
@@ -0,0 +1,19 @@
{ pkgs, lib, ... }:
{
nix.settings.experimental-features = [ "nix-command" "flakes" ];
time.timeZone = "Asia/Tokyo";
i18n.defaultLocale = "ja_JP.UTF-8";
# common user
users.users.moons = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "docker" ];
shell = pkgs.zsh;
};
programs.zsh.enable = true;
services.openssh.enable = true;
# basic network setting
networking.networkmanager.enable = true;
}
+8
View File
@@ -0,0 +1,8 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
git
htop
unzip wget curl
];
}
+22
View File
@@ -0,0 +1,22 @@
{ pkgs, lib, ... }:
{
nixpkgs.config = {
allowUnfreePredicate = pkg: lib.elem (lib.getName pkg) [ "google-chrome" "vscode" ];
};
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
jack.enable = true;
};
environment.systemPackages = with pkgs; [
google-chrome
vscode
];
}
+5
View File
@@ -0,0 +1,5 @@
{ inputs, ... }:
{
imports = [ inputs.impermanence.nixosModules.impermanence ];
}
+7
View File
@@ -0,0 +1,7 @@
{ inputs, ... }:
{
imports = [ inputs.sops-nix.nixosModules.sops ];
# sops.age.sshKeyPaths = [];
# sops.defaultSopsFile = ../secrest/secrets.yaml;
}
+13
View File
@@ -0,0 +1,13 @@
{ pkgs }:
{
packages = with pkgs; [
nodejs_22
pnpm
corepack
git ripgrep fd fzf
];
shellHook = ''
echo "Web dev sell ready: node $(node -v)"
'';
}