commit 8e82650fb4d80f6be07537aff0df5d7f934e25c9 Author: didier amyot Date: Thu Oct 27 14:48:40 2022 -0400 added basic example diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/custom/zig.nix b/custom/zig.nix new file mode 100644 index 0000000..73de84a --- /dev/null +++ b/custom/zig.nix @@ -0,0 +1,62 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, llvmPackages +, libxml2 +, zlib +}: + +stdenv.mkDerivation rec { + pname = "zig"; + version = "0.9.1"; + + src = fetchFromGitHub { + owner = "ziglang"; + repo = pname; + rev = version; + hash = "sha256-x2c4c9RSrNWGqEngio4ArW7dJjW0gg+8nqBwPcR721k="; + }; + + # Fix index out of bounds reading RPATH (cherry-picked from 0.10-dev) + patches = [ ./rpath.patch ]; + + nativeBuildInputs = [ + cmake + llvmPackages.llvm.dev + ]; + + buildInputs = [ + libxml2 + zlib + ] ++ (with llvmPackages; [ + libclang + lld + llvm + ]); + + preBuild = '' + export HOME=$TMPDIR; + ''; + + cmakeFlags = [ + # file RPATH_CHANGE could not write new RPATH + "-DCMAKE_SKIP_BUILD_RPATH=ON" + ]; + + doCheck = true; + checkPhase = '' + runHook preCheck + ./zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig + runHook postCheck + ''; + + meta = with lib; { + homepage = "https://ziglang.org/"; + description = + "General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software"; + license = licenses.mit; + maintainers = with maintainers; [ aiotter andrewrk AndersonTorres ]; + platforms = platforms.unix; + }; +} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..77bb248 --- /dev/null +++ b/flake.lock @@ -0,0 +1,77 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1666887363, + "narHash": "sha256-+bs3z5wk57MHmqTELsx62jrySYJbiWfQIW+Tj79oNGI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "d3f21617acace32097a53b0b74fb5000d333d094", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1662996720, + "narHash": "sha256-XvLQ3SuXnDMJMpM1sv1ifPjBuRytiDYhB12H/BNTjgY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5f326e2a403e1cebaec378e72ceaf5725983376d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1666703756, + "narHash": "sha256-GwpMJ1hT+z1fMAUkaGtvbvofJQwdVFDEGVhfE82+AUk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f994293d1eb8812f032e8919e10a594567cf6ef7", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs_2" + } + }, + "utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7df4c48 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "Question about home-manager."; + + inputs = { + home-manager.url = "github:nix-community/home-manager"; + nixpkgs.url = "nixpkgs/nixos-unstable"; + }; + + outputs = { home-manager, nixpkgs, self,... }: + let + ubuntuSystem = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux ; + modules = [ + { + nixpkgs = { + config = { allowUnfree = true; }; + }; + imports = [./ubuntu.nix]; + } + { + home = { + username = "didier"; + homeDirectory = "/home/didier"; + stateVersion = "22.11"; + }; + } + ]; + }; + in + { + defaultPackage.x86_64-linux = ubuntuSystem.activationPackage; + }; +} diff --git a/ubuntu.nix b/ubuntu.nix new file mode 100644 index 0000000..a4a555b --- /dev/null +++ b/ubuntu.nix @@ -0,0 +1,8 @@ +# Home manager options: https://nix-community.github.io/home-manager/options.html + +{config +, pkgs +,...}: +{ + home.packages = with pkgs; [clojure jq]; +}