From 945cce2f5e487492730e06e13e920e08c55d8084 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Wed, 4 Sep 2024 17:03:21 +0900 Subject: nix: implement nixos module Signed-off-by: Ophestra Umiker --- flake.nix | 59 ++++++++++++++++++++++------------------------------------- 1 file changed, 22 insertions(+), 37 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 1e31f3b5..aa10f3db 100644 --- a/flake.nix +++ b/flake.nix @@ -1,56 +1,41 @@ { - description = "fortify development environment"; + description = "fortify sandbox tool and nixos module"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/24.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small"; }; outputs = { self, nixpkgs }: let - supportedSystems = [ "x86_64-linux" ]; - forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); + supportedSystems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + ]; + + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); in { - devShells = forAllSystems ( + nixosModules.fortify = import ./nixos.nix; + + packages = forAllSystems ( system: let - pkgs = import nixpkgs { inherit system; }; + pkgs = nixpkgsFor.${system}; in { - default = - let - inherit (pkgs) - mkShell - buildGoModule - acl - xorg - ; - in - mkShell { - packages = [ - (buildGoModule rec { - pname = "fortify"; - version = "0.0.0-flake"; - - src = ./.; - vendorHash = null; # we have no Go dependencies :3 + default = self.packages.${system}.fortify; - ldflags = [ - "-s" - "-w" - "-X" - "main.Version=v${version}" - ]; - - buildInputs = [ - acl - xorg.libxcb - ]; - }) - ]; - }; + fortify = pkgs.callPackage ./package.nix { }; } ); + + devShells = forAllSystems (system: { + default = nixpkgsFor.${system}.mkShell { + buildInputs = with nixpkgsFor.${system}; [ self.packages.${system}.fortify ]; + }; + }); }; } -- cgit v1.3.1