Skip to content

Commit

Permalink
new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Sep 15, 2024
1 parent 7f2a9cf commit 4789160
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 213 deletions.
18 changes: 9 additions & 9 deletions flake.lock

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

194 changes: 70 additions & 124 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@

# Flake utils for eachSystem
flake-utils.url = "github:numtide/flake-utils";

# Astro Neovim
# Non-flake repository
astronvim = {
url = "github:AstroNvim/AstroNvim/v3.40.3";
flake = false;
};
};

# In this context, outputs are mostly about getting home-manager what it
Expand All @@ -45,128 +38,81 @@
, ...
} @ inputs:
let
inherit (self) outputs;

# Legacy packages are needed for home-manager
lib = nixpkgs.lib // home-manager.lib;

# Supported systems for your flake packages, shell, etc.
systems = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];

# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;

# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system});

# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
pkgsFor = lib.genAttrs systems (system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
});
# Self instance pointer
outputs = self;

# Define a development shell for each system
devShellFor = system:
afes = flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.mkShell {
NIX_CONFIG = "extra-experimental-features = nix-command flakes repl-flake";
buildInputs = with pkgs; [
nix
nil
git
nixd
just
nixpkgs-fmt
nixpkgs-lint
];
# Nixpkgs packages for the current system
{
# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
packages = import ./pkgs { inherit pkgs; };

# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter = pkgs.nixpkgs-fmt;

# Development shells
devShells.default = import ./shell.nix { inherit pkgs; };
});

# Set environment variables, if needed
shellHook = ''
# export SOME_VAR=some_value
echo "Welcome to Kolyma's dotfiles!"
'';
afse = {
# Nixpkgs and Home-Manager helpful functions
lib = nixpkgs.lib // home-manager.lib;

# Your custom packages and modifications, exported as overlays
overlays = import ./overlays { inherit inputs; };

# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;

# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home;

# Reusable server modules you might want to export
# These are usually stuff you would upstream services to global
serverModules = import ./modules/server;

# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
"Kolyma-1" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nixos/kolyma-1/configuration.nix
];
};
"Kolyma-2" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nixos/kolyma-2/configuration.nix
];
};
"Kolyma-3" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nixos/kolyma-3/configuration.nix
];
};
"Kolyma-4" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nixos/kolyma-4/configuration.nix
];
};
};
in
{
inherit lib;

# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; });

# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter =
forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);

# Your custom packages and modifications, exported as overlays
overlays = import ./overlays { inherit inputs; };

# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;

# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home;

# Reusable server modules you might want to export
# These are usually stuff you would upstream services to global
serverModules = import ./modules/server;

# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
# homeManagerModules = import ./modules/home;

# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
"Kolyma-1" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nixos/kolyma-1/configuration.nix
];
};
"Kolyma-2" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nixos/kolyma-2/configuration.nix
];
};
"Kolyma-3" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nixos/kolyma-3/configuration.nix
];
};
"Kolyma-4" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
# > Our main nixos configuration file <
./nixos/kolyma-4/configuration.nix
];
};
};

# Development shells
devShell = lib.mapAttrs (system: _: devShellFor system) (lib.genAttrs systems { });
# devShells = lib.mapAttrs (system: _: devShellFor system) (lib.genAttrs systems {});
};
in
# Merging all final results
afse // afes;
}
36 changes: 0 additions & 36 deletions home/muzaffar.nix

This file was deleted.

1 change: 0 additions & 1 deletion modules/nixos/users/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
sakhib = import ./sakhib.nix;
sardor = import ./sardor.nix;
shakhzod = import ./shakhzod.nix;
muzaffar = import ./muzaffar.nix;
jakhongir = import ./jakhongir.nix;
}
30 changes: 0 additions & 30 deletions modules/nixos/users/muzaffar.nix

This file was deleted.

1 change: 0 additions & 1 deletion nixos/kolyma-3/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
outputs.nixosModules.users.sakhib
outputs.nixosModules.users.sardor
outputs.nixosModules.users.shakhzod
outputs.nixosModules.users.muzaffar
outputs.nixosModules.users.jakhongir

# Import your deployed service list
Expand Down
24 changes: 12 additions & 12 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
in
import nixpkgs { overlays = [ ]; }
, ...
}: {
default = pkgs.mkShell {
NIX_CONFIG = "extra-experimental-features = nix-command flakes";
nativeBuildInputs = with pkgs; [
nix
nil
git
nixd
nixpkgs-fmt
nixpkgs-lint
];
};
}: pkgs.stdenv.mkDerivation {
name = "instances";

nativeBuildInputs = with pkgs; [
nix
nil
nixd
nixpkgs-fmt
git
];

NIX_CONFIG = "extra-experimental-features = nix-command flakes";
}

0 comments on commit 4789160

Please sign in to comment.