refactor(flake): re-organise systems and modules

This commit is contained in:
Oliver Davies 2023-08-07 22:27:54 +01:00
parent af70a9b56f
commit eac470013b
6 changed files with 51 additions and 45 deletions

View file

@ -6,12 +6,17 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
}; };
outputs = outputs = inputs@{ flake-parts, self, ... }:
inputs@{ flake-parts, home-manager, nixpkgs, nixpkgs-unstable, self, ... }: let
username = "opdavies";
nixos-system = import ./system/nixos { inherit inputs username; };
wsl-system = import ./system/wsl2 { inherit inputs username; };
in
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" ];
perSystem = { pkgs, self', nixpkgs, ... }: { perSystem = { pkgs, self', ... }: {
packages = { packages = {
opdavies-nvim = pkgs.vimUtils.buildVimPlugin { opdavies-nvim = pkgs.vimUtils.buildVimPlugin {
name = "opdavies-nvim"; name = "opdavies-nvim";
@ -24,28 +29,11 @@
flake = { flake = {
nixosConfigurations = { nixosConfigurations = {
nixedo = nixpkgs.lib.nixosSystem { nixedo = nixos-system;
modules = [
./system/nixos/nixedo/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
extraSpecialArgs = { inherit inputs; };
useGlobalPkgs = true;
useUserPackages = true;
users.opdavies = import ./home-manager/nixedo.nix;
};
}
];
};
}; };
homeConfigurations = { homeConfigurations = {
wsl2 = home-manager.lib.homeManagerConfiguration { wsl2 = wsl-system;
modules = [ ./system/wsl2.nix ];
pkgs = nixpkgs.legacyPackages.x86_64-linux;
};
}; };
}; };
}; };

View file

@ -1,7 +1,3 @@
# 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, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
@ -22,11 +18,6 @@ let
}; };
in in
{ {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
nixpkgs = { nixpkgs = {
config = { config = {
allowUnfree = true; allowUnfree = true;
@ -42,7 +33,7 @@ in
DefaultTimeoutStopSec=10s DefaultTimeoutStopSec=10s
''; '';
networking.hostName = "nixedo"; # Define your hostname. # networking.hostName = "nixedo"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary

21
system/nixos/default.nix Normal file
View file

@ -0,0 +1,21 @@
{ inputs, username }:
let
configuration = import ./configuration.nix;
hardware-configuration = import ./hardware-configuration.nix;
in
inputs.nixpkgs.lib.nixosSystem {
modules = [
inputs.home-manager.nixosModules.home-manager {
home-manager = {
extraSpecialArgs = { inherit inputs; };
useGlobalPkgs = true;
useUserPackages = true;
users."${username}" = import ./home-manager.nix;
};
}
configuration
hardware-configuration
];
}

View file

@ -2,11 +2,11 @@
{ {
imports = [ imports = [
./modules/common.nix ../../home-manager/modules/common.nix
./modules/git.nix ../../home-manager/modules/git.nix
./modules/home-manager.nix ../../home-manager/modules/home-manager.nix
./modules/tmux.nix ../../home-manager/modules/tmux.nix
./modules/zsh.nix ../../home-manager/modules/zsh.nix
]; ];
home.stateVersion = "22.05"; home.stateVersion = "22.05";

View file

@ -1,11 +1,17 @@
{ config, lib, pkgs, ... }: { inputs, username }:
{ inputs.home-manager.lib.homeManagerConfiguration {
imports = [ modules = [
../home-manager/modules/common.nix {
../home-manager/modules/git.nix imports = [
../home-manager/modules/home-manager.nix ../home-manager/modules/common.nix
../home-manager/modules/tmux.nix ../home-manager/modules/git.nix
../home-manager/modules/zsh.nix ../home-manager/modules/home-manager.nix
../home-manager/modules/tmux.nix
../home-manager/modules/zsh.nix
];
}
]; ];
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
} }