aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix149
1 files changed, 149 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..1ad60bb
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,149 @@
+{
+ description = "basic flake";
+
+ inputs = {
+ # default nix flake imports
+ nixpkgs = {
+ url = "github:nixos/nixpkgs/nixos-unstable";
+ };
+ home-manager = {
+ url = "github:nix-community/home-manager";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ # custom flakes
+ ## nix-flatpaks
+ nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
+ };
+
+ outputs = inputs @ { nixpkgs, home-manager, ... }:
+ let
+ system = "x86_64-linux";
+
+ pkgs = import nixpkgs {
+ inherit system;
+ };
+
+ commonLibs = with pkgs; lib.makeLibraryPath [
+ acl
+ attr
+ bzip2
+ curl
+ stdenv.cc.cc
+ libsodium
+ libssh
+ libxml2
+ libz
+ musl
+ openssl
+ util-linux
+ xz
+ zlib
+ zstd
+ ];
+
+ commonModules = [
+ home-manager.nixosModules.home-manager
+ {
+ home-manager = {
+ extraSpecialArgs = { inherit inputs; system = system; };
+
+ useGlobalPkgs = true;
+ useUserPackages = true;
+
+ users.aethrvmn = import ./home-manager;
+
+ backupFileExtension = "backup";
+ };
+ }
+ ./modules/common
+ ];
+
+ ClientModules = [
+ inputs.nix-flatpak.nixosModules.nix-flatpak
+ ./modules/client
+ ];
+
+ ServerModules = [
+ ./modules/server
+ ];
+
+ mkHost = { hostPath, extraModules }:
+ nixpkgs.lib.nixosSystem {
+ specialArgs = { inherit inputs; };
+ modules = [ hostPath ] ++ extraModules;
+ };
+ in
+ {
+ nixosConfigurations = {
+ pad = mkHost {
+ hostPath = ./hosts/pad;
+ extraModules = commonModules ++ ClientModules;
+ };
+
+ station = mkHost {
+ hostPath = ./hosts/station;
+ extraModules = commonModules ++ ClientModules ++ ServerModules;
+ };
+
+ server = mkHost {
+ hostPath = ./hosts/server;
+ extraModules = commonModules ++ ServerModules;
+ };
+ };
+
+ # -------------- devShells -------------#
+ devShells.x86_64-linux = {
+ python = pkgs.mkShell {
+ name = "python";
+ packages = with pkgs; [
+ (python3.withPackages (py-pkgs: with py-pkgs; [
+ python-lsp-ruff
+ python-lsp-server
+ ruff
+ ]))
+ (poetry.override { python3 = python313; })
+ ];
+
+ shellHook = ''
+ echo "$(python --version)"
+ echo "$(poetry --version)"
+ '';
+
+ env.LD_LIBRARY_PATH = commonLibs;
+ };
+
+ nim = pkgs.mkShell {
+ name = "nim";
+ packages = with pkgs; [
+ musl
+ nim
+ nimble
+ nimlangserver
+ upx
+ ];
+
+ shellHook = ''
+ echo "$(nim --version)"
+ echo "$(nimble --version)"
+ echo "nimlangserver $(nimlangserver --version)"
+ '';
+
+ env.LD_LIBRARY_PATH = commonLibs;
+ };
+
+ js = pkgs.mkShell {
+ name = "js";
+ packages = with pkgs; [
+ bun
+ ];
+
+ shellHook = ''
+ echo "$(bun --version)"
+ '';
+
+ env.LD_LIBRARY_PATH = commonLibs;
+ };
+ };
+ };
+}
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.